www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d8f8d8a3f88fc8f3ad9e821660f9bc1090265593
parent e89778c1ab4e3e596e3687f86fe47caf201cfc8f
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 24 Jun 2017 01:22:05 -0400

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

Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -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