MIME type sniffing problem

Hi,

Zotero can't sniff the MIME type of this PDF file. It looks like the sniffing code fails (attachment.js:294) because the PDF signature is found after some bogus characters that the file contains (comments added by the PDF creator probably).

Just a minor issue I thought I should let you know about.

Cheers
  • How are you saving that doesn't work? It works for me, saving via Create Web Page Item from Current Page, dragging in the favicon, or dragging the file in from the desktop. (We sometimes use the file extension or content type anyway, but our sniffing code also looks for "%PDF-" anywhere in the first 256 bytes, so the bogus header shouldn't matter.)
  • edited October 18, 2013
    I'm sorry, I forgot to mention that I'm "saving to Zotero" right from the firefox download dialog.
  • edited October 18, 2013
    I haven't run a debugger so maybe I'm wrong about where the problem lies.

    The actual problem I'm having is that whenever I try to save the file directly into the Zotero library I'm getting is this : "An error occurred while saving this link" and I see "Downloaded PDF did not have MIME type 'application/pdf' in Attachments.importFromURL()" in the debug log.

    I hope this helps
  • Looks like we were checking the first 128 bytes, not 256. The gibberish in that file (which is out of spec, and even the 'file' command doesn't identify it as a PDF) was pushing "%PDF-" slightly past 128 bytes.

    I increased the length to 200 and now it works. Changed in the latest 4.0 branch dev build for 4.0.13.

    Thanks.
  • This sounds great :)
Sign In or Register to comment.