Closed Bug 891334 Opened 7 years ago Closed 7 years ago

PDF File upload : wrong mime type (js)

Categories

(Core Graveyard :: File Handling, defect)

22 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla25

People

(Reporter: dr_fx59, Assigned: poiru)

Details

(Whiteboard: [mentor=jdm][lang=c++][good first bug])

Attachments

(1 file)

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.
Yury, any suggestions please ?
Component: Untriaged → File Handling
Product: Firefox → Core
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.
Boris, you seem to have reviewed changes to the extraMimeEntries list in the past. Would adding one for PDF make sense here?
Flags: needinfo?(bzbarsky)
I think adding PDF there is totally reasonable.
Flags: needinfo?(bzbarsky)
This will be a very simple change for someone to make.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [mentor=jdm][lang=c++][good first bug]
Assignee: nobody → birunthan
Status: NEW → ASSIGNED
Attachment #777192 - Flags: review?(josh)
Attachment #777192 - Flags: review?(josh) → review+
Keywords: checkin-needed
Thanks!
https://hg.mozilla.org/mozilla-central/rev/02acc75e4e0c
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Thanks !
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.