mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 12:36:37 +02:00
Importing settings file with an very old storage version did not work at all
This commit is contained in:
parent
350c7b65d4
commit
64b60c834a
2 changed files with 8 additions and 5 deletions
|
@ -122,15 +122,17 @@
|
|||
}
|
||||
}
|
||||
delete json.storageVersion;
|
||||
const keys = Object.keys(json);
|
||||
keys.forEach(function(key){
|
||||
const keys = Object.keys(json).filter(function(key){
|
||||
const setting = settings.getDefinition(key);
|
||||
if (!settings){
|
||||
throw new Error("Unknown setting " + key + ".");
|
||||
if (!setting){
|
||||
logging.error("Unknown setting " + key + ".");
|
||||
return false;
|
||||
}
|
||||
if (!setting.fixed && setting.invalid(json[key])){
|
||||
throw new Error("Invalid value " + json[key] + " for " + key + ".");
|
||||
logging.error("Invalid value " + json[key] + " for " + key + ".");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
keys.forEach(function(key){
|
||||
settings[key] = json[key];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue