From 690ceac4b3546f51f640f2adb4c8d2426e441803 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 2 Nov 2011 00:25:47 -0400 Subject: [PATCH] Fix transferring documents between translator sandboxes --- .../zotero/xpcom/translation/translate.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 053a87944..33fb57f18 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -227,8 +227,28 @@ Zotero.Translate.Sandbox = { if(Zotero.isFx && !Zotero.isBookmarklet && (translate instanceof Zotero.Translate.Web || translate instanceof Zotero.Translate.Search)) { - // necessary to get around object wrappers in Firefox + // Necessary to get around object wrappers in Firefox + var attachments = item.attachments; + delete item.attachments; + item = translate._sandboxManager.sandbox.Zotero._transferItem(JSON.stringify(item)); + item.attachments = []; + + // Manually copy attachments in case there are documents, which + // can't be serialized and don't need to be + if(attachments) { + for(var i=0; i