backups: fix restore code path after backup id changes

This commit is contained in:
Girish Ramakrishnan
2022-04-05 09:28:30 -07:00
parent b4b999bd74
commit 709d4041b2
7 changed files with 38 additions and 34 deletions
+2 -2
View File
@@ -106,7 +106,7 @@ async function restore(req, res, next) {
if (typeof backupConfig.format !== 'string') return next(new HttpError(400, 'format must be a string'));
if ('acceptSelfSignedCerts' in backupConfig && typeof backupConfig.acceptSelfSignedCerts !== 'boolean') return next(new HttpError(400, 'format must be a boolean'));
if (typeof req.body.backupId !== 'string') return next(new HttpError(400, 'backupId must be a string'));
if (typeof req.body.remotePath !== 'string') return next(new HttpError(400, 'remotePath must be a string'));
if (typeof req.body.version !== 'string') return next(new HttpError(400, 'version must be a string'));
if ('sysinfoConfig' in req.body && typeof req.body.sysinfoConfig !== 'object') return next(new HttpError(400, 'sysinfoConfig must be an object'));
@@ -116,7 +116,7 @@ async function restore(req, res, next) {
skipDnsSetup: req.body.skipDnsSetup || false
};
const [error] = await safe(provision.restore(backupConfig, req.body.backupId, req.body.version, req.body.sysinfoConfig || { provider: 'generic' }, options, AuditSource.fromRequest(req)));
const [error] = await safe(provision.restore(backupConfig, req.body.remotePath, req.body.version, req.body.sysinfoConfig || { provider: 'generic' }, options, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, {}));