diff --git a/chrome/content/zotero/import/mendeley/mendeleyImport.js b/chrome/content/zotero/import/mendeley/mendeleyImport.js index 92cd68e471..9d6613e2e6 100644 --- a/chrome/content/zotero/import/mendeley/mendeleyImport.js +++ b/chrome/content/zotero/import/mendeley/mendeleyImport.js @@ -1626,13 +1626,19 @@ Zotero_Import_Mendeley.prototype._saveAnnotations = async function (annotations, let file = await attachmentItem.getFilePathAsync(); if (file) { // Fix blank PDF attachment MIME type from previous imports + let type = 'application/pdf'; if (!attachmentItem.attachmentContentType) { - let type = 'application/pdf'; if (Zotero.MIME.sniffForMIMEType(await Zotero.File.getSample(file)) == type) { attachmentItem.attachmentContentType = type; await attachmentItem.saveTx(this._saveOptions); } } + + if (attachmentItem.attachmentContentType !== type) { + Zotero.debug(`Skipping ${annotations.length} annotations for non-PDF (${attachmentItem.attachmentContentType}) file ${file}`); + // do not attempt to import annotations for non-PDF files + return; + } let annotationMap = new Map(); for (let annotation of annotations) {