Commit 4faf880a authored by Girish Ramakrishnan's avatar Girish Ramakrishnan

Fix crash with unencrypted backups

parent f417a49b
......@@ -104,10 +104,12 @@ function api(provider) {
}
function injectPrivateFields(newConfig, currentConfig) {
if (newConfig.password === exports.SECRET_PLACEHOLDER) {
delete newConfig.password;
newConfig.encryption = currentConfig.encryption;
if ('password' in newConfig) {
if (newConfig.password === exports.SECRET_PLACEHOLDER) {
delete newConfig.password;
}
}
newConfig.encryption = currentConfig.encryption;
if (newConfig.provider === currentConfig.provider) api(newConfig.provider).injectPrivateFields(newConfig, currentConfig);
}
......
......@@ -401,13 +401,9 @@ function setBackupConfig(backupConfig, callback) {
backups.testConfig(backupConfig, function (error) {
if (error) return callback(error);
if ('password' in backupConfig) { // user changed password
if (backupConfig.password) {
backupConfig.encryption = backups.generateEncryptionKeysSync(backupConfig.password);
delete backupConfig.password;
} else {
backupConfig.encryption = null;
}
if ('password' in backupConfig) { // user set password
backupConfig.encryption = backups.generateEncryptionKeysSync(backupConfig.password);
delete backupConfig.password;
}
backups.cleanupCacheFilesSync();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment