From 82411490795c1a6a2b88e640a3ba1effea4dacff Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 22 Nov 2017 04:22:08 -0500 Subject: [PATCH] Fix sync error if item with no content type somehow was indexed https://forums.zotero.org/discussion/68954/mimetype-is-undefined-error Not sure how this could happen. --- chrome/content/zotero/xpcom/fulltext.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js index c062f0c111..b03df67e93 100644 --- a/chrome/content/zotero/xpcom/fulltext.js +++ b/chrome/content/zotero/xpcom/fulltext.js @@ -849,7 +849,7 @@ Zotero.Fulltext = Zotero.FullText = new function(){ let item = yield Zotero.Items.getAsync(itemID); let libraryKey = item.libraryKey; let contentType = item.attachmentContentType; - if (isCachedMIMEType(contentType) || Zotero.MIME.isTextType(contentType)) { + if (contentType && (isCachedMIMEType(contentType) || Zotero.MIME.isTextType(contentType))) { try { let cacheFile = this.getItemCacheFile(item).path; if (yield OS.File.exists(cacheFile)) { @@ -904,7 +904,7 @@ Zotero.Fulltext = Zotero.FullText = new function(){ } else { Zotero.debug("Skipping non-text file getting full-text content for item " - + libraryKey, 2); + + `${libraryKey} (contentType: ${contentType})`, 2); // Delete rows for items that weren't supposed to be indexed yield Zotero.DB.executeTransaction(function* () {