Hard-code MIME-extension mappings for common file formats
Categories
(Firefox :: File Handling, enhancement, P3)
Tracking
()
People
(Reporter: hsivonen, Unassigned, NeedInfo)
References
(Depends on 1 open bug)
Details
(Whiteboard: [necko-triaged])
The file upload form control has a bunch of problems with common file formats. As far as I can tell, there are two types of problems:
- Reliance of system settings in a manner that allows other apps that make changes to the Windows registry to remove reasonable associations between MIME types and file name extensions. We should only take additions from the system settings.
- Not having done a systematic update in 20 years or so.
We should make it so that regardless of system settings, we provide reasonable mappings between MIME types and file name extensions for common file formats.
Off the top of my head, we should have registry-independent mappings for at least:
- HTML
- CSS
- JS
- PNG
- GIF
- JPEG
- SVG
- WebP
- AVIF
- Ogg, including .opus
- MP3
- WebM
- MPEG-4 family
- MPEG1/2 family
- JPEG2000
- HEIF
- Various "raw" photo formats
- Photoshop
- GIMP
- Illustrator
- Inkscape
- iCalendar
- vCard
- OpenDocument family
- OOXML family
- Legacy Microsoft Office family
There may be present-day common formats that are reasonable to upload that I'm missing now. The point is that there are now formats that are more relevant than .ra
, which we do handle.
Reporter | ||
Comment 1•4 years ago
|
||
Per bug 1619153 comment 3 treating as a MIME service bug.
Updated•4 years ago
|
Comment 2•4 years ago
|
||
We already have this list, it's at https://searchfox.org/mozilla-central/rev/598e50d2c3cd81cd616654f16af811adceb08f9f/uriloader/exthandler/nsExternalHelperAppService.cpp#470 , and the file metadata says this goes under File Handling, so I'm moving the bug.
However, it's quite an old list and it could do with some additions/changes. It doesn't have everything listed in comment #0.
Henri, would you mind compiling a list of what you think is missing based on comment #0? If you feel like you could write a patch, even better. :-)
Comment 3•4 years ago
•
|
||
The following MIME types / file extensions from comment 0 are already supported:
Updated Dec 2020
- HTML, CSS, JS
- PNG, GIF, JPEG, SVG, WebP, AVIF
- Ogg and .opus, MP3, WebM, MPEG-4 family
- vCard
- OpenDocument family
- OOXML family
- Legacy Microsoft Office family
- iCalendar
The following aren't yet supported:
- MPEG1/2 family
- JPEG2000
- HEIF
- Various "raw" photo formats
- Photoshop
- GIMP
- Illustrator
- Inkscape
We also support some other more obscure things like .rtf
, .arj
, .gz
(but not .zip
?)
Side Note: JavaScript uses the less common but still specified MIME type application/x-javascript
.
Comment 4•4 years ago
|
||
This list might be a good starting point actually: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
Updated•2 years ago
|
Description
•