From de2dec921fd578e62a58c40ab3dbd7d0abd40f3c Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 17 Apr 2013 02:35:44 -0400 Subject: [PATCH] Fix https://forums.zotero.org/discussion/28922/ --- .../content/zotero/xpcom/server_connector.js | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js index 5e755155b..f52633b20 100644 --- a/chrome/content/zotero/xpcom/server_connector.js +++ b/chrome/content/zotero/xpcom/server_connector.js @@ -55,6 +55,14 @@ Zotero.Server.Connector.AttachmentProgressManager = new function() { this.getProgressForID = function(progressID) { return progressID in attachmentProgress ? attachmentProgress[progressID] : 0; }; + + /** + * Check if we have received progress for a given attachment + */ + this.has = function(attachment) { + return attachmentsInProgress.has(attachment) + && attachmentsInProgress.get(attachment) in attachmentProgress; + } }; /** @@ -339,11 +347,21 @@ Zotero.Server.Connector.SaveItem.prototype = { // save items var itemSaver = new Zotero.Translate.ItemSaver(libraryID, Zotero.Translate.ItemSaver.ATTACHMENT_MODE_DOWNLOAD, 1, undefined, cookieSandbox); - itemSaver.saveItems(data.items, function(returnValue, newItems) { + itemSaver.saveItems(data.items, function(returnValue, items) { if(returnValue) { try { - for each(var item in newItems) { - if(collection) collection.addItem(item.id); + // Remove attachments not being saved from item.attachments + for(var i=0; i