commit 3390f2405b6cce49c1fde2e08ad94e5f9a343f53
parent d857a813b92a7ee3cee7ba660ea98ffc1ea71c92
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 26 Jan 2018 03:32:09 -0500
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.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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,