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.
This commit is contained in:
Dan Stillman 2018-01-26 03:32:09 -05:00
parent d857a813b9
commit 3390f2405b

View file

@ -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,