From 6a0351c9405354c3722cb4f317653ab3bf07b045 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Thu, 28 Mar 2013 00:55:05 -0500 Subject: [PATCH] Don't break when stringifying item fields. Broken by 2f8f18c9571010b5f9d9035f62b590e63ffc1e4f --- chrome/content/zotero/xpcom/translation/translate.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index dba25677d..dc07a9269 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -98,8 +98,9 @@ Zotero.Translate.Sandbox = { delete item[i]; continue; } - - var isObject = typeof val === "object" || typeof val === "xml" || typeof val === "function", + + var type = typeof val; + var isObject = type === "object" || type === "xml" || type === "function", shouldBeObject = allowedObjects.indexOf(i) !== -1; if(isObject && !shouldBeObject) { // Convert things that shouldn't be objects to objects @@ -108,7 +109,7 @@ Zotero.Translate.Sandbox = { } else if(shouldBeObject && !isObject) { translate._debug("Translate: WARNING: typeof "+i+" is "+type+"; converting to array"); item[i] = [val]; - } else if(typeof val === "string") { + } else if(type === "string") { // trim strings item[i] = val.trim(); }