Support multiple extensions for MIME types in FileExtensionTrait - #1538
Merged
garak merged 1 commit intoSep 20, 2025
Merged
Conversation
Refactored the extension mapping to use arrays instead of single values, allowing multiple file extensions to share the same MIME type. Added support for srt/vtt subtitle files and kml geospatial data.
Contributor
|
Just a point of view. When someone ask for a new MIME type exception, we have to update the trait and create a new version. Maybe, it will be better to allow user to configure it and create a compiler pass to merge existing mapping within the configuration. Yaml Example: vich_uploader:
extensions:
txt: ['csv', 'srt', 'vtt']
xml: ['gpx', 'kml']
xlsx: ['xlsb'] |
Collaborator
|
So end users will keep changes for themselves instead of sharing with us? |
Contributor
|
Yes, that's kind of the idea. You can keep the existing list and merge with the list defined in the configuration. |
Contributor
Author
|
IMHO, it's better to share new extensions and MIME types with the community. For those who don't want to share, there is the |
Contributor
|
What if someone wants one of the defined extensions and not the others? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactored the extension mapping to use arrays instead of single values, allowing multiple file extensions to share the same MIME type. Added support for srt/vtt subtitle files and kml geospatial data.