Fix "constraint failed" error on itemCreators during sync

This commit is contained in:
Dan Stillman 2009-09-01 07:54:53 +00:00
parent 305b6dc891
commit 45e761449f

View file

@ -3143,12 +3143,13 @@ Zotero.Sync.Server.Data = new function() {
var e = new Zotero.Error(msg, "MISSING_OBJECT"); var e = new Zotero.Error(msg, "MISSING_OBJECT");
throw (e); throw (e);
} }
var l = creator.@libraryID.toString();
l = l ? l : null; creator.creator.@libraryID = data.libraryID;
var creatorObj = Zotero.Sync.Server.Data.xmlToCreator(creator.creator); var creatorObj = Zotero.Sync.Server.Data.xmlToCreator(creator.creator);
if (l != creatorObj.libraryID || creator.@key.toString() != creatorObj.key) {
throw ("Creator id " + creatorObj.id + " does not match " if (creator.@key.toString() != creatorObj.key) {
+ "item creator in Zotero.Sync.Server.Data.xmlToItem()"); throw ("Creator does not match item creator in Zotero.Sync.Server.Data.xmlToItem() "
+ "(" + creator.@key.toString() + "!=" + creatorObj.key + ")");
} }
} }
item.setCreator( item.setCreator(