validate the backup format

This commit is contained in:
Girish Ramakrishnan
2023-08-15 18:37:21 +05:30
parent cd9d49116e
commit 9dedf0ec05
2 changed files with 14 additions and 12 deletions

View File

@@ -458,14 +458,6 @@ function validateCsp(csp) {
return null;
}
function validateBackupFormat(format) {
assert.strictEqual(typeof format, 'string');
if (format === 'tgz' || format == 'rsync') return null;
return new BoxError(BoxError.BAD_FIELD, 'Invalid backup format');
}
function validateUpstreamUri(upstreamUri) {
assert.strictEqual(typeof upstreamUri, 'string');
@@ -2205,7 +2197,7 @@ async function importApp(app, data, auditSource) {
let restoreConfig;
if (data.remotePath) { // if not provided, we import in-place
error = validateBackupFormat(backupFormat);
error = backups.validateBackupFormat(backupFormat);
if (error) throw error;
// TODO: make this smarter to do a read-only test and check if the file exists in the storage backend