From 28bbce4bf50809f30ca4417add0f7f38893c01b9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 11 Jul 2009 01:17:01 +0000 Subject: [PATCH] Trigger full reset on missing collection parent --- chrome/content/zotero/xpcom/sync.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js index 05df248fd..2cd0cde09 100644 --- a/chrome/content/zotero/xpcom/sync.js +++ b/chrome/content/zotero/xpcom/sync.js @@ -3221,6 +3221,7 @@ Zotero.Sync.Server.Data = new function() { * Recursively save collections from the top down */ function _saveCollections(collections) { + var originalLength = collections.length; var unsaved = []; var parentKey, parentCollection; @@ -3246,6 +3247,12 @@ Zotero.Sync.Server.Data = new function() { continue; } + if (unsaved.length == originalLength) { + var msg = "Incomplete collection hierarchy cannot be saved in Zotero.Sync.Server.Data._saveCollections()"; + var e = new Zotero.Error(msg, "MISSING_OBJECT"); + throw (e); + } + if (unsaved.length) { _saveCollections(unsaved); }