From 4d1081be1a9f6a53435a210642ee71cefa0d643b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 21 Feb 2009 22:13:57 +0000 Subject: [PATCH] Fix FK constraint error with tags, often after the tag conflict window --- chrome/content/zotero/xpcom/data/tag.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/tag.js b/chrome/content/zotero/xpcom/data/tag.js index ba415d1e1..cf2edfb46 100644 --- a/chrome/content/zotero/xpcom/data/tag.js +++ b/chrome/content/zotero/xpcom/data/tag.js @@ -221,11 +221,11 @@ Zotero.Tag.prototype.save = function (full) { } if (this.type != 0 && this.type != 1) { - throw ('Invalid tag type ' + this.type + ' in Zotero.Tag.save()'); + throw ('Invalid tag type ' + this.type + ' for tag ' + this.id + ' in Zotero.Tag.save()'); } if (!this.name) { - throw ('Tag name is empty in Zotero.Tag.save()'); + throw ('Tag ' + this.id + ' name is empty in Zotero.Tag.save()'); } if (!this._changed) { @@ -590,7 +590,9 @@ Zotero.Tag.prototype._setLinkedItems = function (itemIDs) { if (currentIDs.indexOf(id) != -1) { Zotero.debug("Item " + itemIDs[i] + " is already linked to tag " + this.id); - oldIDs.push(id); + if (oldIDs.indexOf(id) == -1) { + oldIDs.push(id); + } continue; }