From 395d596105a55823bf584c08839833f100d5507e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 24 Feb 2015 15:54:34 -0500 Subject: [PATCH] Don't try to add child items to collections dragging cross-library Previously, if you dragged a standalone attachment to a collection in another library where the item already existed as a child item, it would crash Zotero on a collection-item constraint. --- chrome/content/zotero/xpcom/collectionTreeView.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index af9844fd2..860a1b154 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -1758,8 +1758,12 @@ Zotero.CollectionTreeView.prototype.drop = function(row, orient, dataTransfer) // Add items to target collection if (targetCollectionID) { - var collection = Zotero.Collections.get(targetCollectionID); - collection.addItems(newIDs); + let ids = newIDs.filter(function (itemID) { + var item = Zotero.Items.get(itemID); + return !item.getSource(); + }); + let collection = Zotero.Collections.get(targetCollectionID); + collection.addItems(ids); } // If moving, remove items from source collection