From 2f6f2feade248896df007ca3d3c4498b8ea50069 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 29 Apr 2023 18:46:30 -0400 Subject: [PATCH] =?UTF-8?q?`for=E2=80=A6in`=20=E2=86=92=20`for=E2=80=A6of`?= =?UTF-8?q?=20in=20`sniffForMIMEType()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome/content/zotero/xpcom/mime.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/mime.js b/chrome/content/zotero/xpcom/mime.js index 04e33c188e..9357959ec4 100644 --- a/chrome/content/zotero/xpcom/mime.js +++ b/chrome/content/zotero/xpcom/mime.js @@ -224,22 +224,22 @@ Zotero.MIME = new function(){ * Searches string for magic numbers */ this.sniffForMIMEType = function (str) { - for (let i in _snifferEntries) { + for (let [magic, type, offset] of _snifferEntries) { let match = false; // If an offset is defined, match only from there - if (_snifferEntries[i][2] != undefined) { - if (str.substr(_snifferEntries[i][2]).indexOf(_snifferEntries[i][0]) == 0) { + if (offset != undefined) { + if (str.substr(offset).indexOf(magic) == 0) { match = true; } } // Otherwise allow match anywhere in sample // (200 bytes from getSample() by default) - else if (str.indexOf(_snifferEntries[i][0]) != -1) { + else if (str.indexOf(magic) != -1) { match = true; } if (match) { - return _snifferEntries[i][1]; + return type; } }