commit e2ff2c3ab764f3095de846880681fd75670f965d
parent 3f28260507f116864b9f0fe82326a8b0fd2173c6
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 26 Dec 2010 09:14:55 +0000
Fix a tag syncing edge case (which shouldn't be possible with production sync server)
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -4212,8 +4212,15 @@ Zotero.Sync.Server.Data = new function() {
function _deleteConflictingTag(syncSession, name, type, libraryID) {
var tagID = Zotero.Tags.getID(name, type, libraryID);
if (tagID) {
- Zotero.debug("Deleting conflicting local tag " + tagID);
+ Zotero.debug("Deleting conflicting local '" + name + "' tag " + tagID);
var tag = Zotero.Tags.get(tagID);
+ // Tag has already been deleted, which can happen if the server has
+ // two new tags that differ only in case, and one matches a local tag
+ // with a different key, causing that tag to be deleted already.
+ if (!tag) {
+ Zotero.debug("Local tag " + tagID + " doesn't exist");
+ return false;
+ }
var linkedItems = tag.getLinkedItems(true);
Zotero.Tags.erase(tagID);
Zotero.Tags.purge();