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.
This commit is contained in:
Dan Stillman 2017-11-22 04:22:08 -05:00
parent d45a9c22c5
commit 8241149079

View file

@ -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* () {