Open Bug 1619203 Opened 4 years ago Updated 2 years ago

Hard-code MIME-extension mappings for common file formats

Categories

(Firefox :: File Handling, enhancement, P3)

enhancement

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
  • PDF
  • 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.

See Also: → 1366645
See Also: → 1367490

Per bug 1619153 comment 3 treating as a MIME service bug.

Component: DOM: Core & HTML → Networking
Whiteboard: [necko-triaged]

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. :-)

Component: Networking → File Handling
Flags: needinfo?(hsivonen)
Product: Core → Firefox
Blocks: 1571247
See Also: → 1650640
Depends on: 1650640
Depends on: 1657311

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
  • PDF
  • 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.

Depends on: 1660560
See Also: → 1671930
Depends on: 1671930
Depends on: 1681924
See Also: 1671930
Depends on: 1660059
No longer depends on: 1650640
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.