commit 49d5c1fd31eafb2964e3bdc9eb7f10834f3efdcb
parent ec04a6e98dab6de30942c3b59fcc2289cf601fd3
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 17 Mar 2011 21:34:59 +0000
Prevent erroneous conflicts due to Windows newlines in imported notes (which should be fixed separately)
Using a try/catch to prevent unexpected errors in 2.1 Final
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -3679,7 +3679,18 @@ Zotero.Item.prototype.diff = function (item, includeMatches, ignoreFields) {
}
if (thisData.note != undefined) {
- changed = thisData.note != otherData.note;
+ // replace() keeps Windows newlines from triggering erroneous conflicts,
+ // though this should really be fixed at the data layer level
+ //
+ // Using a try/catch to avoid unexpected errors in 2.1 Final
+ try {
+ changed = thisData.note.replace(/\r\n/g, "\n") != otherData.note.replace(/\r\n/g, "\n");
+ }
+ catch (e) {
+ Zotero.debug(e);
+ Components.utils.reportError(e);
+ changed = thisData.note != otherData.note;
+ }
if (includeMatches || changed) {
diff[0].note = thisData.note;
diff[1].note = otherData.note;