Fix infinite loop restoring from trash if item has itself as relation

This commit is contained in:
Dan Stillman 2017-06-24 01:22:05 -04:00
parent e89778c1ab
commit d8f8d8a3f8

View file

@ -1538,6 +1538,14 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
'item', predicate, thisURI
);
for (let mergeItem of mergeItems) {
// An item shouldn't have itself as a dc:replaces relation, but if it does it causes an
// infinite loop
if (mergeItem.id == this.id) {
Zotero.logError(`Item ${this.libraryKey} has itself as a ${predicate} relation`);
this.removeRelation(predicate, thisURI);
continue;
}
mergeItem.removeRelation(predicate, thisURI);
yield mergeItem.save({
skipDateModifiedUpdate: true