commit 925bc7ca5ba3e9df6980823089ec2134f68ab972
parent abf3037a24ddf8dd290f55a758d1edbcf3bbfb99
Author: Simon Kornblith <simon@simonster.com>
Date: Fri, 5 Nov 2010 02:52:14 +0000
fix 2.1b1-related field code corruption
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git 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);
+ }
}
}