Last Comment Bug 891334 - PDF File upload : wrong mime type (js)
: PDF File upload : wrong mime type (js)
[mentor=jdm][lang=c++][good first bug]
Product: Core Graveyard
Classification: Graveyard
Component: File Handling (show other bugs)
: 22 Branch
: x86_64 Windows 7
-- normal (vote)
: mozilla25
Assigned To: Birunthan Mohanathas [:poiru]
Depends on:
  Show dependency treegraph
Reported: 2013-07-09 06:16 PDT by dr_fx59
Modified: 2016-06-22 12:16 PDT (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---

Add default MIME type definition for .pdf as 'application/pdf' (1.26 KB, patch)
2013-07-17 10:13 PDT, Birunthan Mohanathas [:poiru]
josh: review+
Details | Diff | Splinter Review

Description User image dr_fx59 2013-07-09 06:16:08 PDT
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 (Beta/Release)
Build ID: 20130618035212

Steps to reproduce:

I am using an input of type file to upload pdf using ajax on Firefox 22.0

Actual results:

I want to check the file mime type to be sure to get a pdf.
So I am using this javascript : 
var file = uploader.container.find('input[type="file"]')[0].files[0];

then I check the property  'type' of the file var. (file.type)

The value is 'application/octet-stream' instead of 'application/pdf' !

Expected results:

The value of file.type should be  'application/pdf'.

The same code with the same file works on IE10 and Chrome 28.0.1500.71.
Comment 1 User image Paul Silaghi, QA [:pauly] 2013-07-15 05:23:35 PDT
Yury, any suggestions please ?
Comment 2 User image Josh Matthews [:jdm] 2013-07-15 07:21:45 PDT
I think we've got two choices here: if the OS does not appear to be providing us with any good hint, we can add the pdf extension to the list extraMimeEntries list in nsExternalHelperAppService, or we could rely on pdf.js to add a MIME entry for PDFs via the ext-to-type-mapping category. Personally, I think we would want this regardless of the presence of pdf.js.
Comment 3 User image Josh Matthews [:jdm] 2013-07-15 07:23:34 PDT
Boris, you seem to have reviewed changes to the extraMimeEntries list in the past. Would adding one for PDF make sense here?
Comment 4 User image Boris Zbarsky [:bz] (still a bit busy) 2013-07-15 13:22:34 PDT
I think adding PDF there is totally reasonable.
Comment 5 User image Josh Matthews [:jdm] 2013-07-15 13:55:10 PDT
This will be a very simple change for someone to make.
Comment 6 User image Birunthan Mohanathas [:poiru] 2013-07-17 10:13:32 PDT
Created attachment 777192 [details] [diff] [review]
Add default MIME type definition for .pdf as 'application/pdf'
Comment 7 User image Josh Matthews [:jdm] 2013-07-17 10:19:56 PDT
Comment 8 User image Ryan VanderMeulen [:RyanVM] 2013-07-17 11:40:38 PDT
Comment 9 User image Ryan VanderMeulen [:RyanVM] 2013-07-18 18:06:59 PDT
Comment 10 User image dr_fx59 2013-07-18 23:38:40 PDT
Thanks !

Note You need to log in before you can comment on or make changes to this bug.