New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filename is too long exception when importing media images #29377
Comments
Hi @stephansteiner. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
I had similar experience of uploading image with long name to the product images, it's really not obvious why magento can't handle it. It could be fixed in few ways:
I'll add "Severity: S2", as it's not breaking critical functionality, but quite annoying when you're getting this issue. But TBH fix is quite simple from customer perspective - just rename the file and try again |
Renaming the file is not an option - especially when we migrate the shop from M1 to M2, where the import from the ERP system worked with Magento1 SOAP API with longer filenames. On the other hand our customer needs "seo-optimized" image names that contain the product name (plus some version info we need for our import/upgrade logic). So 90 characters for a dispretion path is very "short" if you have longer product names. |
Hi @engcom-Delta. Thank you for working on this issue.
|
✅ Confirmed by @engcom-Delta Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself. |
I researched about it. According to https://en.wikipedia.org/wiki/Comparison_of_file_systems , I know that wikipedia isn't the best reference to find things related, but most of operation systems the maximum filename length is 255 characters. https://www.ibm.com/support/knowledgecenter/SSEQVQ_8.1.9/client/c_cmd_filespecsyntax.html On this documentation above says:
On this documentation above from azure says: Directory and file component names must be no more than 255 characters in length. So, the path + filename cannot exceed 255 characters in length. The current logic is incorrect because it's checking only the basename (filename), not the entire path (directory + filename). So, I created a pull request fixing it: |
Hi @stephansteiner. Thank you for your report. The fix will be available with the upcoming 2.4.2 release. |
Why this "fix" was reverted in 2.4.3? |
This issue seems to have been fixed "again" in |
I'm trying to import product images with very long names.
295744_20200804070722_tanzteppich_colorx_150_plus_1004222_16330_chroma_blau_schw_150cm_lfm.jpg
There is a limit in Magento of 90 characters which I don't fully understand.
All unix filesstems support 255 characters, Windows as well, the value column in catalog_product_entity_varchar is 255 characters, the value column in catalog_product_entity_media_gallery is also 255 characters.
The limit of 90 characters is annotated in vendor/magento/framework/File/Uploader.php with the following comment:
// account for excessively long filenames that cannot be stored completely in database
I don't know of any database column less than 255 characters. So the hard limit could be much higher, like 240 characters (the filename in the media gallery will be prepended with the dispretion path of /2/9/ which is 5 extra characters.
Tested on Magento 2.3, on Magento 2.4 there is the same limitation.
Preconditions (*)
Steps to reproduce (*)
Entity Type: Products
Import Behaviour: Add/Update
Validation Strategy: Stop on Error
Example CSV file: sample_long.csv.txt
Expected result (*)
Actual result (*)
"Check Data" passes, while Import itself will fail due to the fact the product image cannot be saved because of exceeded length
The error message is misleading as it says: "1. Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in row(s): 1"
When using a shorter image name, import works.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: