Fix erroneous conflits due to encode XML entities

This commit is contained in:
Dan Stillman 2011-04-04 11:03:28 +00:00
parent 431de84f9f
commit 68715ed99f

View File

@ -3679,7 +3679,7 @@ Zotero.Item.prototype.diff = function (item, includeMatches, ignoreFields) {
} }
if (thisData.note != undefined) { if (thisData.note != undefined) {
// Whitespace normalization // Whitespace and entity normalization
// //
// Ideally this would all be fixed elsewhere so we didn't have to // Ideally this would all be fixed elsewhere so we didn't have to
// convert on every sync diff // convert on every sync diff
@ -3704,6 +3704,18 @@ Zotero.Item.prototype.diff = function (item, includeMatches, ignoreFields) {
thisNote = thisNote.replace(re, "<p> </p>"); thisNote = thisNote.replace(re, "<p> </p>");
otherNote = otherNote.replace(re, "<p> </p>"); otherNote = otherNote.replace(re, "<p> </p>");
// Unencode XML entities
thisNote = thisNote.replace(/&amp;/g, "&");
otherNote = otherNote.replace(/&amp;/g, "&");
thisNote = thisNote.replace(/&apos;/g, "'");
otherNote = otherNote.replace(/&apos;/g, "'");
thisNote = thisNote.replace(/&quot;/g, '"');
otherNote = otherNote.replace(/&quot;/g, '"');
thisNote = thisNote.replace(/&lt;/g, "<");
otherNote = otherNote.replace(/&lt;/g, "<");
thisNote = thisNote.replace(/&gt;/g, ">");
otherNote = otherNote.replace(/&gt;/g, ">");
changed = thisNote != otherNote; changed = thisNote != otherNote;
} }
catch (e) { catch (e) {