www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d881d4a6473fe9b5e72d9ecab48b8fde450f6149
parent 48f6de7ad1f487f184a4efd333caf5caca9bdb63
Author: Simon Kornblith <simon@simonster.com>
Date:   Sat, 14 Mar 2015 18:54:25 -0400

Fix a bug saving attachments to items with notes via the server

Diffstat:
Mchrome/content/zotero/xpcom/connector/translate_item.js | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/connector/translate_item.js b/chrome/content/zotero/xpcom/connector/translate_item.js @@ -175,13 +175,14 @@ Zotero.Translate.ItemSaver.prototype = { * attachmentCallback() will be called with all attachments that will be saved */ "_saveToServer":function(items, callback, attachmentCallback) { - var newItems = [], typedArraysSupported = false; + var newItems = [], itemIndices = [], typedArraysSupported = false; try { typedArraysSupported = !!(new Uint8Array(1) && new Blob()); } catch(e) {} for(var i=0, n=items.length; i<n; i++) { var item = items[i]; + itemIndices[i] = newItems.length; newItems = newItems.concat(Zotero.Utilities.itemToServerJSON(item)); if(typedArraysSupported) { for(var j=0; j<item.attachments.length; j++) { @@ -215,9 +216,8 @@ Zotero.Translate.ItemSaver.prototype = { function(prefs) { if(typedArraysSupported) { - Zotero.debug(response); - for(var i in resp.success) { - var item = items[i], key = resp.success[i]; + for(var i=0; i<items.length; i++) { + var item = items[i], key = resp.success[itemIndices[i]]; if(item.attachments && item.attachments.length) { me._saveAttachmentsToServer(key, me._getFileBaseNameFromItem(item), item.attachments, prefs, attachmentCallback);