From 6a629490b3e00a72249af23e8752a5cda6e5eb3a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 26 Aug 2010 21:34:44 +0000 Subject: [PATCH] - Fix an XML parsing error (due to trailing whitespace, weirdly) that could cause endless sync icon spinning - Remove extra whitespace in collection-item blocks that was causing sync upload errors (also fixed on the server) --- chrome/content/zotero/xpcom/sync.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 83eb0073d..afbc88c9b 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -1351,8 +1351,10 @@ Zotero.Sync.Server = new function () { _error(response.firstChild.firstChild.nodeValue); } + var xml = Zotero.Utilities.prototype.trim(xmlhttp.responseText.replace(/<\?xml.*\?>\s*/, '')); + // Strip XML declaration and convert to E4X - var xml = new XML(xmlhttp.responseText.replace(/<\?xml.*\?>/, '')); + xml = new XML(xml); try { var updateKey = xml.@updateKey.toString(); @@ -3741,7 +3743,7 @@ Zotero.Sync.Server.Data = new function() { xml.collections + ' ' + child.id : child.id; } else */if (child.type == 'item') { - xml.items = xml.items ? + xml.items = xml.items.toString() ? xml.items + ' ' + child.key : child.key; } }