Assets don't use the encoded url in control panel
Bug Description
If you upload an asset with a special character in the file name such as + the control panel will not display or link to the asset correctly. This only effects the control panel, the asset is available using the url encoded file name.
How to Reproduce
Upload/copy a file to assets with a special character
Extra Detail
Example: File+Name.jpg will be encoded and accessible at /assets/File%2BName.jpg but the control panel will try and fetch the unencoded resource path /assets/File+Name.jpg which 404s and won't preview. This also effects the "Open in new window" button.
Environment
Statamic 3.1.34 Pro Laravel 8.55.0 PHP 7.3.27
Install method (choose one):
- Fresh install from
statamic/statamic
Potentially related to https://github.com/statamic/cms/issues/3398 Seems like their might need to be some more testing around asset names?
Hi @DoubleJ-G, thanks for the report! I am getting different behavior than you are describing. I tried the following with an image named File+Name.jpg:
- Upload the file in the Asset Browser -> The asset is renamed to
File-Name.jpgand it opens fine in the Asset Editor and via the 'Open in a new window' button. - Place the file using the filesystem in the
public/assetsfolder and reload the Asset Browser -> The asset is still calledFile+Name.jpgand it opens fine in the Asset Editor and via the 'Open in a new window' button. - I also used the Asset Editor to rename an image without special characters to
File+Name.jpg-> The asset is calledFile+Name.jpgand it opens fine in the Asset Editor and via the 'Open in a new window' button. - For good measure I uploaded a file in the Asset Browser named
File%2BName.jpg-> The asset is renamed toFile+Name.jpgand it opens fine in the Asset Editor and via the 'Open in a new window' button.
I see that the renaming is not totally consistent, but that is a different issue. I can open all the files in the Control Panel. What should I do differently to make the issue happen?
Tested in Chrome and Safari Statamic 3.1.34 Pro Laravel 8.51.0 PHP 7.4.22
Slugifying would help... statamic/cms#6030
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
Still an issue...
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
Still a thing.
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.