From 3390f2405b6cce49c1fde2e08ad94e5f9a343f53 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 26 Jan 2018 03:32:09 -0500 Subject: [PATCH] Warn about version 0 when saving to sync cache This should be an error, because the API will never return 0, but most tests don't currently set the version properly in the response JSON. --- chrome/content/zotero/xpcom/sync/syncLocal.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js index 393cebd4a..21763a915 100644 --- a/chrome/content/zotero/xpcom/sync/syncLocal.js +++ b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -1056,6 +1056,12 @@ Zotero.Sync.Data.Local = { Zotero.debug(json, 1); throw new Error("Missing 'version' property in JSON"); } + if (json.version === 0) { + Zotero.debug(json, 1); + // TODO: Fix tests so this doesn't happen + Zotero.warn("'version' cannot be 0 in cache JSON"); + //throw new Error("'version' cannot be 0 in cache JSON"); + } // If direct data object passed, wrap in fake response object return json.data === undefined ? { key: json.key,