backup/import/restore: fix crash with root path calcuation
rootPath was calculated before the arguments were validated
This commit is contained in:
@@ -169,6 +169,7 @@ async function restoreTask(backupConfig, remotePath, ipv4Config, options, auditS
|
||||
|
||||
try {
|
||||
setProgress('restore', 'Downloading box backup');
|
||||
backupConfig.rootPath = backups.getRootPath(backupConfig, paths.MANAGED_BACKUP_MOUNT_DIR);
|
||||
await backuptask.restore(backupConfig, remotePath, (progress) => setProgress('restore', progress.message));
|
||||
|
||||
setProgress('restore', 'Downloading mail backup');
|
||||
@@ -231,8 +232,7 @@ async function restore(backupConfig, remotePath, version, ipv4Config, options, a
|
||||
}
|
||||
|
||||
await backups.setupStorage(backupConfig, paths.MANAGED_BACKUP_MOUNT_DIR); // this validates mountOptions
|
||||
backupConfig.rootPath = backups.getRootPath(backupConfig, paths.MANAGED_BACKUP_MOUNT_DIR);
|
||||
error = await backups.testStorage(backupConfig); // this validates provider and it's api options. requires rootPath
|
||||
error = await backups.testStorage(Object.assign({ mountPath: paths.MANAGED_BACKUP_MOUNT_DIR }), backupConfig); // this validates provider and it's api options. requires mountPath
|
||||
if (error) throw error;
|
||||
|
||||
error = await network.testIPv4Config(ipv4Config);
|
||||
|
||||
Reference in New Issue
Block a user