Skip importing annotations for non-PDF attachments
This commit is contained in:
parent
ad661e9c8d
commit
124b64f3a2
1 changed files with 7 additions and 1 deletions
|
@ -1626,13 +1626,19 @@ Zotero_Import_Mendeley.prototype._saveAnnotations = async function (annotations,
|
||||||
let file = await attachmentItem.getFilePathAsync();
|
let file = await attachmentItem.getFilePathAsync();
|
||||||
if (file) {
|
if (file) {
|
||||||
// Fix blank PDF attachment MIME type from previous imports
|
// Fix blank PDF attachment MIME type from previous imports
|
||||||
|
let type = 'application/pdf';
|
||||||
if (!attachmentItem.attachmentContentType) {
|
if (!attachmentItem.attachmentContentType) {
|
||||||
let type = 'application/pdf';
|
|
||||||
if (Zotero.MIME.sniffForMIMEType(await Zotero.File.getSample(file)) == type) {
|
if (Zotero.MIME.sniffForMIMEType(await Zotero.File.getSample(file)) == type) {
|
||||||
attachmentItem.attachmentContentType = type;
|
attachmentItem.attachmentContentType = type;
|
||||||
await attachmentItem.saveTx(this._saveOptions);
|
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();
|
let annotationMap = new Map();
|
||||||
for (let annotation of annotations) {
|
for (let annotation of annotations) {
|
||||||
|
|
Loading…
Reference in a new issue