Fix duplicate matching when ISBN is non-sensical

Re https://forums.zotero.org/discussion/43046/items-mistakenly-identified-as-duplicates/
This commit is contained in:
Aurimas Vinckevicius 2014-12-10 15:59:26 -06:00
parent ee389f106e
commit 2f79cb221f

View file

@ -170,7 +170,9 @@ Zotero.Duplicates.prototype._findDuplicates = function () {
}
// If no comparison function, check for exact match
else {
if (rows[i].value !== rows[j].value) {
if (!rows[i].value || !rows[j].value
|| (rows[i].value !== rows[j].value)
) {
break;
}
}
@ -205,8 +207,8 @@ Zotero.Duplicates.prototype._findDuplicates = function () {
var isbnCache = {};
if (rows) {
for each(var row in rows) {
row.value = (row.value+'').replace(/[^\dX]+/ig, '').toUpperCase(); //ignore formatting
isbnCache[row.itemID] = row.value;
row.value = Zotero.Utilities.cleanISBN('' + row.value);
if (row.value) isbnCache[row.itemID] = row.value;
}
rows.sort(sortByValue);
processRows();