application/octet-stream mime type being returned as '' in FileList
Reported by
a...@evosite.co.uk,
Jun 27 2017
|
||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3133.0 Safari/537.36 Steps to reproduce the problem: 1. FileList returned from input[type=file] following a change event returns type as '' when application/octet-stream mime type is present. See attached HTML demo file for testing. I've also attached a .dng file with the mime type application/octet-stream 2. View the console from the test.html page following selecting the attached file and look at file[0].type Testing with other files with an alternative mime type appears to work correctly. Tested in Chrome 59-61 (stable, dev and canary) on Windows 7, 8 and 10. The issue was present in all versions. Test file to upload and simplified HTML to highlight the issue. What is the expected behavior? Correct mime type returned by the browser so we can validate files strictly. What went wrong? type returned a blank string. Did this work before? No Chrome version: 61.0.3133.0 Channel: stable OS Version: 10.0 Flash Version:
,
Jun 27 2017
,
Jun 28 2017
,
Jun 29 2017
Tested this issue on Windows 10 with chrome #61.0.3143.0 with provided files in comment #0, #1 Observed after uploading .dwg file, in the console file[0].type is empty. attaching the screen-shot for reference. aran@ could you confirm that this is the issue you are facing. Thank You...
,
Jun 29 2017
Hi, Yes, this is indeed the issue. All other file types I could think to test all correctly returned the mime types expected. To ensure this wasn't simply a bad file, I have downloaded multiple *.dwg files from different sources online and found the results to all be the same (blank string returned). Many thanks, Aran
,
Jun 29 2017
Thank you for providing more feedback. Adding requester "kkaluri@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jun 29 2017
May be the same as issue 155455 - if the host operating system doesn't provide a mapping for the type (e.g. the extension is unknown, can't be sniffed, etc), the empty string is used for the type. We should compare behavior with other browsers and see if they produce 'application/octet-stream' or '' for unknown types.
,
Jun 30 2017
Firefox has the same behavior - type is empty string if the system can't determine the content type. On Windows, type resolution is done via the registry (with a very small number of hardcoded fallbacks in Chrome). If you run regedit.exe and look in HKEY_CLASSES_ROOT you'll see entries for known extensions. On my Windows box I don't have an entry for ".dwg" for example, but under e.g. ".avi" there is a key ContentType "video/avi" Since (1) you can't assume everyone has apps installed locally, and (2) browsers can't map every extension to a content type, and (3) you can't trust extensions due to security concerns, you can't really rely on the content type being meaningful. Chrome's relevant code is in net/base/mime_util.cc and specifically https://cs.chromium.org/chromium/src/net/base/mime_util.cc?type=cs&l=64 with kPrimaryMappings consulted first, then the operating system (e.g. windows registry), then kSecondaryMappings. (I've raised this as an interop issue against the File API spec. https://github.com/w3c/FileAPI/issues/51 - maybe we shouldn't even check the operating system, all browsers should hard-code a list, and otherwise return blank.)
,
Jun 15 2018
,
Jun 15 2018
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by a...@evosite.co.uk
, Jun 27 2017106 KB
106 KB Download