diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index 92bad615a1..9e625fb5d7 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -1038,7 +1038,15 @@ Zotero.Translate.ItemGetter.prototype = { }, "setAll": Zotero.Promise.coroutine(function* (libraryID, getChildCollections) { - this._itemsLeft = yield Zotero.Items.getAll(libraryID, true); + this._itemsLeft = (yield Zotero.Items.getAll(libraryID, true)) + .filter((item) => { + // Don't export annotations + switch (item.itemType) { + case 'annotation': + return false; + } + return true; + }); if(getChildCollections) { this._collectionsLeft = Zotero.Collections.getByLibrary(libraryID); diff --git a/test/tests/translateTest.js b/test/tests/translateTest.js index 605a48ff09..936d30afa4 100644 --- a/test/tests/translateTest.js +++ b/test/tests/translateTest.js @@ -2121,6 +2121,25 @@ describe("Zotero.Translate.ItemGetter", function() { }); }); + describe("#setAll()", function () { + it("should exclude annotations", async function () { + var attachment = await importFileAttachment('test.pdf'); + var annotation = await createAnnotation('highlight', attachment); + + var getter = new Zotero.Translate.ItemGetter(); + await getter.setAll(attachment.libraryID, false); + + var item; + while (item = getter.nextItem()) { + if (item.itemType == 'annotation') { + assert.fail("Annotation item should not be returned from nextItem()"); + break; + } + } + assert.equal(getter.numItems, 1); + }); + }); + describe("#_attachmentToArray()", function () { it("should handle missing attachment files", function* () { var item = yield importFileAttachment('test.png');