From 8da5e3bc099d0c7026187f8cb005a69a4d72d090 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 30 Mar 2011 00:38:14 +0000 Subject: [PATCH] Maybe fix "constraint failed" sync error in collection.js --- chrome/content/zotero/xpcom/data/collection.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/collection.js b/chrome/content/zotero/xpcom/data/collection.js index b37440b4e..f2194869f 100644 --- a/chrome/content/zotero/xpcom/data/collection.js +++ b/chrome/content/zotero/xpcom/data/collection.js @@ -534,6 +534,13 @@ Zotero.Collection.prototype.save = function () { } if (newids.length) { + // TEMP: Remove duplicates, which shouldn't be necessary + var len1 = newids.length; + newids = Zotero.Utilities.arrayUnique(newids); + if (len1 != newids.length) { + Zotero.debug("newids was not unique in Zotero.Collection.save()", 2); + } + var sql = "SELECT IFNULL(MAX(orderIndex)+1, 0) " + "FROM collectionItems WHERE collectionID=?" var orderStatement = Zotero.DB.getStatement(sql);