Open Bug 1182948 Opened 9 years ago Updated 2 years ago

firefox filechooser filters tiff files incorrectly

Categories

(Firefox :: File Handling, defect)

defect

Tracking

()

People

(Reporter: jedierikb, Unassigned)

References

()

Details

(Keywords: testcase, Whiteboard: [STR in comment #10])

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

Steps to reproduce:

<input type="file" accept="image/tiff,image/tif,image/x-tif,image/x-tiff,application/tiff,application/x-tiff" />




Actual results:

Then try to select a file with extension .tif (not .tiff).  The .tif files are not available.  They do, however, have the right mime/type.


Expected results:

Files with extension .tif should be available.

more here: http://stackoverflow.com/questions/31350290/firefox-filechooser-filters-tiff-files
Possible duplicate of bug 1156273.

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
20150630154324
File picker is set to “All files (*.*)” by default. *.tif files show up in the list.

Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:42.0) Gecko/20100101 Firefox/42.0
20150711030210
File picker is set to “image/tiff (*.tiff)” by default. *.tif files don't show up in the list.
Component: Untriaged → DOM: Core & HTML
Keywords: testcase
Product: Firefox → Core
So I expect we ask the OS for what file extensions it corresponds to and it looks like the OS is answering "tiff".  Which is not the same thing as "tif".

Possibly bugs on our end are if we only ask for the primary extension, not all extensions, or if we incorrectly set up the filepicker with the extension list.

Looking at the DOM code in HTMLInputElement::SetFilePickerFiltersFromAccept, we ask the MIME service for information for the given MIME type, get the list of all the file extensions from the result, and add those to the filter in the file picker.  So it sounds like the MIME service is claiming the "image/tiff" type only maps to the "tiff" extension.

It looks to me like nsOSHelperAppService::GetMIMEInfoFromOS goes and gets a single extension for the given MIME type.  I don't know enough about the MIME setup on Windows to tell whether that's because the registry only stores one extension per MIME type or whether that's the issue here...  Jim, do you know, or know who does?

We _do_ have image/tiff in our list of type-to-extension mappings that gets used if 
the OS doesn't know about the type, with both extensions listed there, but it sounds like in this case the OS does claim to know about the type.
Status: UNCONFIRMED → NEW
Component: DOM: Core & HTML → File Handling
Ever confirmed: true
Flags: needinfo?(jmathies)
(In reply to Boris Zbarsky [:bz] from comment #2)
> Possibly bugs on our end are if we only ask for the primary extension, not
> all extensions, or if we incorrectly set up the filepicker with the
> extension list.

See bug 1155154 for problems with filtering by file extension rather than MIME type.

> It looks to me like nsOSHelperAppService::GetMIMEInfoFromOS goes and gets a
> single extension for the given MIME type.  I don't know enough about the
> MIME setup on Windows to tell whether that's because the registry only
> stores one extension per MIME type or whether that's the issue here...  Jim,
> do you know, or know who does?

Note that the reporter is using Mac OS X.
> See bug 1155154 for problems with filtering by file extension rather than MIME type.

Native filepickers filter by extension....

> Note that the reporter is using Mac OS X.

Oh, good point.  I got confused by comment 1, which was all about Windows.  On Mac, GetMIMEInfoFromOS definitely looks like it's only ensuring that the preferred extension from the NSURLFileTypeMappings is returned in the mimeinfo.  That looks wrong, at first glance.

Steven, does NSURLFileTypeMappings have other extensions we should be adding in here?
Flags: needinfo?(jmathies) → needinfo?(smichaud)
> The .tif files are not available.  They do [not], however, have the right mime/type.

I assume I was correct to insert the "[not]".

Is there an easy way to tell which mime type a file has when you select it in the native filepicker?  Yes, I could add debug logging to the tree, but for the moment I'm feeling lazy :-)

By the way, I tested in FF 40 (one of the betas) with firefox-logo-wordmark.png and two copies of it made by exporting it to TIFF format (in Preview) -- one with the (standard) .tiff extension and the other with a .tif extension.  All three show up with the same icon (a thumbnail of the image) in the file picker launched from this bug's testcase.
Flags: needinfo?(smichaud)
Flags: needinfo?(smichaud)
> The .tif files are not available.

Just noticed another "not" that doesn't match my results.  As I said in comment #5, both the .tiff and .tif files *are* available in the filepicker in my tests.
I should also mention that I tested on OS X 10.8.5.  Later I'll try on 10.10.4.
I get exactly the same results on OS X 10.10.4.  I don't see the bug at all.

Either this bug is invalid or I don't understand it.  Until that's resolved, I'm going to clear the needinfo request.
Flags: needinfo?(smichaud)
Hmm.  Reporter, do you have any entries for tiff in the mimeTypes.rdf file in your Firefox user profile?  See https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data?redirectlocale=en-US&redirectslug=Profiles#w_how-do-i-find-my-profile for how to find that file.
I just got a brand new 10.10.4 MacOS laptop.  Downloaded firefox 39.0 as the very first application on the machine.  Made a simple page with:

<input type="file" accept="image/tiff,image/tif,application/pdf" />

[ http://codepen.io/anon/pen/bdObPg ]

Clicked "Browse" on the input file button.  Navigated to a directory with three files:
image.tif
image.tiff
report.pdf

In the filechooser dialog opened by Firefox:
If _Format: All Files_ is selected, I see all three files as selectable.
else if _Format: All Supported Types_ is selected, only image.tiff and report.pdf are selectable.
else If _Format: Preview Document_ is selected, only image.tiff is selectable.

For _All Supported Types_, I expect image.tif to be selectable.  It is not.

I hope this report is helpful.
Simon, do _you_ have any mimeTypes.rdf entries for this MIME type?
Flags: needinfo?(smichaud)
Sorry, here is what I found for you just now:
http://alumni.media.mit.edu/~erikb/tmp/mimeTypes.rdf
Right, nothing in there, as expected for a clean install.  Just trying to figure out why you and Steven (yes, I totally typed the wrong name in comment 12, my apologies) are seeing different behavior...
jedierikb, your report in comment #10 is quite different from your original report -- much better and more detailed.  This I *can* reproduce.

I'm not sure when I can get to this.  It may be a while.
Flags: needinfo?(smichaud)
Whiteboard: [STR in comment #10]
Product: Core → Firefox
Version: 39 Branch → unspecified
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.