backups: encryptedFilenames and mountOptions are validated at provider level

This commit is contained in:
Girish Ramakrishnan
2024-04-09 12:31:10 +02:00
parent 424a3c2b53
commit 5fb7d53018
+3 -5
View File
@@ -122,15 +122,13 @@ async function setLimits(req, res, next) {
async function setStorage(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
// provider specific options are validated by provider backends
if (typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required'));
if (typeof req.body.format !== 'string') return next(new HttpError(400, 'format must be a string'));
if ('password' in req.body && typeof req.body.password !== 'string') return next(new HttpError(400, 'password must be a string'));
if ('encryptedFilenames' in req.body && typeof req.body.encryptedFilenames !== 'boolean') return next(new HttpError(400, 'encryptedFilenames must be a boolean'));
if (typeof req.body.format !== 'string') return next(new HttpError(400, 'format must be a string'));
if ('acceptSelfSignedCerts' in req.body && typeof req.body.acceptSelfSignedCerts !== 'boolean') return next(new HttpError(400, 'acceptSelfSignedCerts must be a boolean'));
if ('mountOptions' in req.body && typeof req.body.mountOptions !== 'object') return next(new HttpError(400, 'mountOptions must be a object'));
// testing the backup using put/del takes a bit of time at times
req.clearTimeout();