Browse Source

Bugfix: deduping caused an error if an array property was missing

Conversion from array to string should happen independently for
the compared properties, not only when both are arrays.
pull/444/head
Vesa Meskanen 9 years ago
parent
commit
00a4bd52a3
  1. 6
      middleware/dedupe.js

6
middleware/dedupe.js

@ -91,10 +91,8 @@ function propMatch(item1, item2, prop) {
// in the case the property is an array (currently only in parent schema) // in the case the property is an array (currently only in parent schema)
// simply take the 1st item. this will change in the near future to support multiple hierarchies // simply take the 1st item. this will change in the near future to support multiple hierarchies
if (_.isArray(prop1) && _.isArray(prop2)) { if (_.isArray(prop1)) { prop1 = prop1[0]; }
prop1 = prop1[0]; if (_.isArray(prop2)) { prop2 = prop2[0]; }
prop2= prop2[0];
}
if (normalizeString(prop1) !== normalizeString(prop2)) { if (normalizeString(prop1) !== normalizeString(prop2)) {
throw new Error('different'); throw new Error('different');

Loading…
Cancel
Save