If we upload assets into Craft CMS that contain BOM (https://en.wikipedia.org/wiki/Byte_order_mark) characters at the end of the file name, then with debug mode enabled, we get the error message:
"unable to check if the file exists"
If the user does not have developer mode enabled, then they get the error message:
"A server error occurred"
Steps to reproduce
Navigate to /admin/assets
Attempt to upload an image with BOM characters, example:
See one of the above error messages depending on your user settings
Expected behavior
We expected Craft CMS to clean these gremlin characters and upload these files, or at least provide a more user friendly error message for admin users if this is problematic or not possible.
Actual behavior
Confusing error message that required us to debug this issue and work around this by renaming these files and uploading for our client.
Craft CMS version
4.4.4
PHP version
8.0
Operating system and version
Debian GNU/Linux 10 (buster) (Azure App Service Linux)
What happened?
Description
If we upload assets into Craft CMS that contain BOM (https://en.wikipedia.org/wiki/Byte_order_mark) characters at the end of the file name, then with debug mode enabled, we get the error message:
"unable to check if the file exists"
If the user does not have developer mode enabled, then they get the error message:
"A server error occurred"
Steps to reproduce
Expected behavior
We expected Craft CMS to clean these gremlin characters and upload these files, or at least provide a more user friendly error message for admin users if this is problematic or not possible.
Actual behavior
Confusing error message that required us to debug this issue and work around this by renaming these files and uploading for our client.
Craft CMS version
4.4.4
PHP version
8.0
Operating system and version
Debian GNU/Linux 10 (buster) (Azure App Service Linux)
Database type and version
MySQL 8.0
Image driver and version
imagick module version 3.7.0
Installed plugins and versions