diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js index 5e755155b0..f52633b20f 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