From dc39ca37566ac379611cad9253d48a054d915e9b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 19 Nov 2024 07:09:55 -0500 Subject: [PATCH] Don't detect MP3 with embedded image as JPEG https://forums.zotero.org/discussion/119725/z-imports-mp3s-as-images-if-image-is-embedded-in-the-file We were looking for "JFIF" anywhere in the sample, which could include the ID3 tag. (An upcoming change will also have it just trust the file extension when one is available.) --- chrome/content/zotero/xpcom/mime.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/mime.js b/chrome/content/zotero/xpcom/mime.js index dcd26e00f1..88e7c0fbbe 100644 --- a/chrome/content/zotero/xpcom/mime.js +++ b/chrome/content/zotero/xpcom/mime.js @@ -29,7 +29,7 @@ Zotero.MIME = new function(){ this.sniffForBinary = sniffForBinary; this.hasNativeHandler = hasNativeHandler; - // Magic numbers + // Magic numbers -- see https://en.wikipedia.org/wiki/List_of_file_signatures var _snifferEntries = [ ["%PDF-", "application/pdf"], ["%!PS-Adobe-", 'application/postscript', 0], @@ -42,12 +42,21 @@ Zotero.MIME = new function(){ ["