Closed Bug 1364550 Opened 7 years ago Closed 7 years ago

File Input with `accept="image/jpeg"` does not accept .jpeg on macOS

Categories

(Core :: DOM: Core & HTML, defect, P2)

54 Branch
Unspecified
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: dduan, Assigned: jessica)

References

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Steps to reproduce:

Create a file input that accepts jpegs

`<input type="file" accept="mime/jpeg">`



Actual results:

If you open the file selector, "all supported files" should be enabled by default but any file with .jpeg extension will greyed out. Only .jpg extension will be available.


Expected results:

.jpeg and .jpg extensions should both be available
Component: Untriaged → DOM
Product: Firefox → Core
Confirmed on MacOS also. 

Note that the steps are wrong, should be:


`<input type="file" accept="image/jpeg">`

But it's still broken.
Hi Jessica, mind taking a look?
Component: DOM → DOM: Core & HTML
Flags: needinfo?(jjong)
Priority: -- → P2
I can reproduce this only on Mac not on Ubuntu.

HTMLInputElement::SetFilePickerFiltersFromAccept gets mimeInfo from mimeService, and mimeInfo is implemented for each OS.
For mac, it seems that we use the API `preferredExtensionForMIMEType`, so we only get one extension. Maybe we should use `extensionsForMIMEType` instead. Let me see if it works...


[1] http://searchfox.org/mozilla-central/rev/ae24a3c83d22e0e35aecfd9049c2b463ca7e045b/uriloader/exthandler/mac/nsOSHelperAppService.mm#504
Flags: needinfo?(jjong)
Summary: File Input with `accept="mime/jpeg"` does not accept .jpeg → File Input with `accept="image/jpeg"` does not accept .jpeg
Assignee: nobody → jjong
Attached patch patch, v1. (obsolete) — Splinter Review
Comment on attachment 8868409 [details] [diff] [review]
patch, v1.

Hi baku, I've no idea who to ask for a review, maybe you can help? Thanks.
Attachment #8868409 - Flags: review?(amarchesini)
Hmm, I can reproduce this on Windows 10 as well, and I can't find a suitable Windows API for this, we can only get one extension for MIME type from "HKEY_CLASSES_ROOT\MIME\Database\Content Type".

It looks like Chrome has two hard coded mapping lists that it adds to the OS extension list.


[1] https://cs.chromium.org/chromium/src/net/base/mime_util.cc?l=544
Attachment #8868409 - Flags: review?(amarchesini) → review+
Thanks baku.

Let's fix this for macOS first and file a separate bug to consider whether we should have a hard-coded list.
Attached patch patch. r=bakuSplinter Review
Added reviewer's name, carrying r+.
Attachment #8868409 - Attachment is obsolete: true
Attachment #8868948 - Flags: review+
See Also: → 1366645
Pushed by ihsiao@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2acee92959cb
Get all extensions for a MIME type and not just the preferred one (macOS). r=baku
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2acee92959cb
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
See Also: → 1367490
OS: Unspecified → Mac OS X
Summary: File Input with `accept="image/jpeg"` does not accept .jpeg → File Input with `accept="image/jpeg"` does not accept .jpeg on macOS
See Also: → 1619153
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: