From 24104dc685c353871c06bfb6d041aeb63a5b34b2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 26 Dec 2021 23:15:47 -0500 Subject: [PATCH] Fix error generating context menu for multiple standalone attachments Regression from f161d167ae --- chrome/content/zotero/zoteroPane.js | 1 + test/tests/zoteroPaneTest.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index b2bcf97b9c..62a948d5cb 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -3075,6 +3075,7 @@ var ZoteroPane = new function() function attachmentsWithExtractableAnnotations(item) { + if (!item.isRegularItem()) return []; return Zotero.Items.get(item.getAttachments()) .filter(item => isAttachmentWithExtractableAnnotations(item)); } diff --git a/test/tests/zoteroPaneTest.js b/test/tests/zoteroPaneTest.js index d66974ffbf..cfc0384d44 100644 --- a/test/tests/zoteroPaneTest.js +++ b/test/tests/zoteroPaneTest.js @@ -801,4 +801,14 @@ describe("ZoteroPane", function() { assert.lengthOf(Object.keys(conditions), 3); }); }); + + describe("#buildItemContextMenu()", function () { + it("should build menu for multiple standalone file attachments", async function () { + var item1 = await importFileAttachment('test.png'); + var item2 = await importFileAttachment('test.png'); + + await zp.selectItems([item1.id, item2.id]); + await zp.buildItemContextMenu(); + }); + }); })