-
Notifications
You must be signed in to change notification settings - Fork 518
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
File naming (file extensions) changed between 2.4.1 and 2.4.2 #1479
Comments
I have the same issues with CSV files now. They result in .txt files which is not acceptable for us |
This is either a problem with symfony/mime component or with your file having the wrong mime type |
Simple CSV files are always considered I guess I will need to write a custom Namer since I need the uploaded files to keep their extension. |
A possible improvement to the bundle could be adding a new option, something like PRs are welcome. |
About a possible alternate solution: we could add a map of extensions allowed for reach mime type, and then keep the original extension when it belongs to that list. Probably easier. |
The change in the proposed PR should fix the problem with the CSV extension. If you have more cases to add, feel free to suggest them. |
BC Break Report
Summary
The handling of file extensions changed in 2.4.2 with this commit 4962a3e (Specifically the changes to the FileExtensionTrait)
Previous behavior
Previously the file extension was based on the extension of the original name of the uploaded file.
Current behavior
The original file extension is now ignored and the extension is 'guessed' based on the mime type.
How to reproduce
zip-file.txt
.file -i zip-file.txt
. It should returnapplication/zip
.zip-file.txt
using vich uploader. I am using the UniqidNamer, but any namer that usesFileExtensionTrait
is affected.I know the commit was made to address a potential security issue, but I thought the behaviour change was worth reporting.
The text was updated successfully, but these errors were encountered: