From 925bc7ca5ba3e9df6980823089ec2134f68ab972 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 5 Nov 2010 02:52:14 +0000 Subject: [PATCH] fix 2.1b1-related field code corruption --- chrome/content/zotero/xpcom/integration.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 6182926062..7d178751ee 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1259,11 +1259,16 @@ Zotero.Integration.Session.prototype.unserializeCitation = function(arg, index) try { var citation = Zotero.JSON.unserialize(arg); } catch(e) { - // fix for corrupted fields + // fix for corrupted fields (corrupted by Word, somehow) try { var citation = Zotero.JSON.unserialize(arg.substr(0, arg.length-1)); } catch(e) { - throw new Zotero.Integration.CorruptFieldException(arg); + // another fix for corrupted fields (corrupted by 2.1b1) + try { + var citation = Zotero.JSON.unserialize(arg.replace(/{{((?:\s*,?"unsorted":(?:true|false)|\s*,?"custom":"(?:(?:\\")?[^"]*\s*)*")*)}}/, "{$1}")); + } catch(e) { + throw new Zotero.Integration.CorruptFieldException(arg); + } } }