-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Directory and filename must be no more than 255 characters in length #30011
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
Directory and filename must be no more than 255 characters in length #30011
Conversation
Hi @lfluvisotto. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests 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 |
@ihor-sviziev could you have a look? |
@magento run all tests |
@ihor-sviziev these failed checks, should I install the composer package b2b to see what's going on? |
@lfluvisotto, I don't have my opinion about the pull request itself, but I don't think you understood documentation correctly, including Azure and Wikipedia. While wikipedia says that most filesystems has 255 symbols restriction for the filename, the pathname length is mostly not limited or measured in thousands of symbols. And here's what azure documentation says about path name:
So the statement that combined path + name cannot be more than 255 symbols is not correct. The name could have 255 symbols and each directory could have 255 symbols with max limit for the whole path length of 2048 symbols. And the part of the documentation that you referred to make this statement just says about limitations of each node of a path that could be either a file or a directory, so these limitations are common for them. It doesn't mean it's the limitation for the pathname:
|
On the table, the column that stores path + filename the data type is varchar 255. We could define text data type for the column but I don't think it's necessary, we should avoid changes on data type but we should be able to use the 255 characters available. It would be good we remove the limitation of 90 characters on the basename of file. The limitation of 90 characters length doesn't make sense, we should keep the maximum length of defined data type can store itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lfluvisotto,
Please review my comments and review failing tests, seems like tests should be fixed also. Also please cover your changes with some kind of test in case if failing tests not covering your case
491de69
to
cafcf7f
Compare
@magento run all tests |
1 similar comment
@magento run all tests |
79a96bc
to
aa5039c
Compare
@magento run all tests |
@lfluvisotto your changes looks good. could you cover your changes with some automated test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lfluvisotto your changes looks good. could you cover your changes with some automated test?
@magento run all tests |
@magento run Unit Tests Strange... unit tests failed, but no failures in reports. Restarting... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lfluvisotto could you check why the unit tests are failing? I don't see anything in the reports, but could you try to run the tests you've changed?
@lfluvisotto @ihor-sviziev here is the reason we are getting the failure on the Unit Tests:
That seems to be related to the change of the Writer's implementation to its interface on the test (app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/UploaderTest.php). |
The weird thing is: other php files use the same I did and don't have problems. I'm rechecking it. |
now it's supposed to run ok, I changed by \Magento\Framework\Filesystem\Directory\Write |
c40dae8
to
52f39a4
Compare
@magento run all tests |
Hi @ihor-sviziev, thank you for the review. |
✔️ QA Passed BEFORE switching to the PR, an error appeared on Importing AFTER switching to the PR, the Import is successfull The image is successfully added to Images And Videos section Manual testing scenario
If the filename is too long, a proper error message appears on Importing |
Hi @lfluvisotto, thank you for your contribution! |
Description (*)
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:
https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata
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:
Related Pull Requests
N/A
Fixed Issues
Fixes #29377
Manual testing scenarios (*)
Upload a file where filename is 255 characters length an exception will be thrown.
Questions or comments
N/A
Contribution checklist (*)