From e60bf91e31ef0288ec24039bcce164939ccfeabf Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 6 Mar 2026 00:30:45 -0500 Subject: [PATCH] Fix PDF magic number sniffing matching anywhere in first 200 bytes The %PDF- sniffer entry had no offset constraint, so it matched anywhere in the file sample. This could cause ZIP files containing PDFs to be misidentified as application/pdf when opened, since %PDF- could appear within the first 200 bytes of the archive. Pin the match to offset 0, where it must appear in a valid PDF. Fixes https://forums.zotero.org/discussion/130161/zip-files-and-indexing --- chrome/content/zotero/xpcom/mime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/mime.js b/chrome/content/zotero/xpcom/mime.js index 954b64996f..e823bd61e6 100644 --- a/chrome/content/zotero/xpcom/mime.js +++ b/chrome/content/zotero/xpcom/mime.js @@ -31,7 +31,7 @@ Zotero.MIME = new function () { // Magic numbers -- see https://en.wikipedia.org/wiki/List_of_file_signatures var _snifferEntries = [ - ["%PDF-", "application/pdf"], + ["%PDF-", "application/pdf", 0], ["%!PS-Adobe-", 'application/postscript', 0], ["%! PS-Adobe-", 'application/postscript', 0], ["From", 'text/plain', 0],