restore: fix crash with invalid backup id

This commit is contained in:
Girish Ramakrishnan
2025-01-20 13:51:55 +01:00
parent 4c235f0427
commit 230599417e

View File

@@ -2265,6 +2265,7 @@ async function restore(app, backupId, auditSource) {
// for empty or null backupId, use existing manifest to mimic a reinstall
const backupInfo = backupId ? await backups.get(backupId) : { manifest: app.manifest };
if (!backupInfo) throw new BoxError(BoxError.BAD_FIELD, 'No such backup');
const manifest = backupInfo.manifest;
if (!manifest) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Could not get restore manifest');