From 87120aceba04cf79b732d3e65101ca85e8818ca6 Mon Sep 17 00:00:00 2001 From: nobody Date: Sun, 6 Dec 2020 07:54:26 +0100 Subject: [PATCH] Improved: Backup and restore validation (#174) --- core/storage-manager.js | 7 ++++++- pages/updates/updates.html | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/storage-manager.js b/core/storage-manager.js index 6a34e7cd..4e5e20fe 100644 --- a/core/storage-manager.js +++ b/core/storage-manager.js @@ -148,6 +148,11 @@ storageManager._validation = function (content) { delete content['hideReleaseNotes']; } + // Convert type of updateNotification + if (typeof content.updateNotification === 'string') { + content.updateNotification = parseInt(content.updateNotification); + } + for (const [key, value] of Object.entries(SettingDefaults)) { // If type the same as default settings if (typeof value === typeof content[key]) { @@ -164,7 +169,7 @@ storageManager._validation = function (content) { // Set default if not existing in file imported[key] = value; } else { - alert(chrome.i18n.getMessage('dialogImportFailed')); + alert(chrome.i18n.getMessage('dialogImportFailed') + '\n\n' + key + ': ' + content[key]); throw 'Invalid file!'; } } diff --git a/pages/updates/updates.html b/pages/updates/updates.html index fe3f537d..bd3ab928 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -27,6 +27,7 @@