validate the backup format
This commit is contained in:
10
src/apps.js
10
src/apps.js
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user