import: fix crash because encryption is unset

This commit is contained in:
Girish Ramakrishnan
2020-05-24 18:42:04 -07:00
parent de4b3e55fa
commit 1438ee52a1

View File

@@ -1542,9 +1542,13 @@ function importApp(app, data, auditSource, callback) {
testBackupConfig(function (error) {
if (error) return callback(error);
if (backupConfig && 'password' in backupConfig) {
backupConfig.encryption = backups.generateEncryptionKeysSync(backupConfig.password);
delete backupConfig.password;
if (backupConfig) {
if ('password' in backupConfig) {
backupConfig.encryption = backups.generateEncryptionKeysSync(backupConfig.password);
delete backupConfig.password;
} else {
backupConfig.encryption = null;
}
}
const restoreConfig = { backupId, backupFormat, backupConfig };