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
This commit is contained in:
Dan Stillman 2011-03-17 21:34:59 +00:00
parent ec04a6e98d
commit 49d5c1fd31

View File

@ -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;