Skip to content

Support multiple extensions for MIME types in FileExtensionTrait - #1538

Merged
garak merged 1 commit into
dustin10:masterfrom
endelwar:multiple-extensions-per-mime-type
Sep 20, 2025
Merged

Support multiple extensions for MIME types in FileExtensionTrait#1538
garak merged 1 commit into
dustin10:masterfrom
endelwar:multiple-extensions-per-mime-type

Conversation

@endelwar

Copy link
Copy Markdown
Contributor

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.

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.

@garak garak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@garak
garak merged commit 8a4c742 into dustin10:master Sep 20, 2025
12 checks passed
@endelwar
endelwar deleted the multiple-extensions-per-mime-type branch September 22, 2025 05:20
@laurentmuller

Copy link
Copy Markdown
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']

@garak

garak commented Oct 7, 2025

Copy link
Copy Markdown
Collaborator

So end users will keep changes for themselves instead of sharing with us?

@laurentmuller

Copy link
Copy Markdown
Contributor

Yes, that's kind of the idea. You can keep the existing list and merge with the list defined in the configuration.

@endelwar

endelwar commented Oct 8, 2025

Copy link
Copy Markdown
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 namer_keep_extension parameter (#1540).

@laurentmuller

Copy link
Copy Markdown
Contributor

What if someone wants one of the defined extensions and not the others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants