Closed Bug 508030 Opened 10 years ago Closed 10 years ago
IMIMEService .get Type From Extension fails to find a match in the "ext-to-type-mapping" category if the provided extension is not lowercase
The "ext-to-type-mapping" category, introduced in bug 231886, is meant to contain a set of lowercase file extensions that are checked as a last resort when trying to determine the MIME type of a file based on its extension: https://developer.mozilla.org/en/How_Mozilla_determines_MIME_Types#ExternalHelperAppService At present, however, the check in nsIMIMEService.getTypeFromExtension is case-sensitive and fails to find a match in the "ext-to-type-mapping" category if the extension provided in the argument is not lowercase. In practice, this means that any Mozilla extension that relies on the "ext-to-type-mapping" would fail to open local files if their file extension is not lowercase. For example, Mozilla Archive Format can currently open "Example.mht" but not "Example.MHT", unless the MIME type is already registered in the operating system.
Here is the fix and the test case. Christian, would you like do a first review, since you wrote the original code? With this patch, the behavior for the "ext-to-type-mapping" is now to treat file extensions case-insensitively on all platforms. I think this is the appropriate behavior even for Unix-like platforms, since this will allow, for example, a Mozilla extension on Linux to open a file with an uppercase extension, published by a Windows user on a network share.
10 years ago
Attachment #392251 - Flags: review?(cbiesinger) → review+
Attachment #392251 - Flags: superreview?(bzbarsky) → superreview+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Wow, exceptionally fast review and checkin! :-)
Comment on attachment 392251 [details] [diff] [review] Patch and test case This simple fix is relevant for extensions running on current versions of Firefox and other products.
the test contains a typo. see http://hg.mozilla.org/mozilla-central/rev/28a58910d695 for the fix.
Attachment #392251 - Flags: approval188.8.131.52? → approval184.108.40.206?
(In reply to comment #5) > the test contains a typo. see > http://hg.mozilla.org/mozilla-central/rev/28a58910d695 for the fix. I'm sorry. I always run tests with and without the fix to ensure that they work, but this time it's possible that I erroneously saw a "TEST-PASS" for an unrelated test and overlooked the "TEST-UNEXPECTED-FAIL".
Comment on attachment 392509 [details] [diff] [review] Patch and test case Do not want for 3.0.x. Approved for 220.127.116.11, a=dveditz for release-drivers
Verified for 18.104.22.168 using the checked in testcase.
You need to log in before you can comment on or make changes to this bug.