From 6db1fbd13f71d199a50c35da22d6200bbac756c9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 28 Oct 2019 05:36:44 -0400 Subject: [PATCH] Fix handling of app downgrade to lower global schema version --- chrome/content/zotero/xpcom/schema.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js index 562724d1b5..2a25b0f1c2 100644 --- a/chrome/content/zotero/xpcom/schema.js +++ b/chrome/content/zotero/xpcom/schema.js @@ -325,11 +325,11 @@ Zotero.Schema = new function(){ var pako = {}; Services.scriptloader.loadSubScript("resource://zotero/pako.js", pako); var data = await Zotero.DB.valueQueryAsync( - "SELECT value FROM settings WHERE schema='globalSchema' AND key='data'" + "SELECT value FROM settings WHERE setting='globalSchema' AND key='data'" ); if (data) { try { - data = JSON.parse(pako.inflate(data, { to: 'string' })); + return JSON.parse(pako.inflate(data, { to: 'string' })); } catch (e) { Zotero.warn("Unable to extract global schema -- falling back to file: " + e); @@ -341,9 +341,7 @@ Zotero.Schema = new function(){ // If the data is missing or unreadable in the DB for some reason (e.g., DB corruption), // fall back to the file, though it might be out of date - if (!data) { - data = await _readGlobalSchemaFromFile(); - } + data = await _readGlobalSchemaFromFile(); return data; }