Fix infinite loop restoring from trash if item has itself as relation
This commit is contained in:
parent
e89778c1ab
commit
d8f8d8a3f8
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue