archive: proxy app cannot be archived

This commit is contained in:
Girish Ramakrishnan
2024-12-10 16:29:34 +01:00
parent 0e181cdc82
commit 21c3d16db5
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -2491,6 +2491,8 @@ async function archive(app, backupId, auditSource) {
assert.strictEqual(typeof backupId, 'string');
assert.strictEqual(typeof auditSource, 'object');
if (app.manifest.id === constants.PROXY_APP_APPSTORE_ID) throw new BoxError(BoxError.BAD_FIELD, 'cannot archive proxy app');
const result = await backups.getByIdentifierAndStatePaged(app.id, backups.BACKUP_STATE_NORMAL, 1, 1);
if (result.length === 0) throw new BoxError(BoxError.BAD_STATE, 'No recent backup to archive');
if (result[0].id !== backupId) throw new BoxError(BoxError.BAD_STATE, 'Latest backup id has changed');