settings api: key if present must be a string

This commit is contained in:
Girish Ramakrishnan
2016-10-13 15:32:18 -07:00
parent d460c36e14
commit 49f7fb552b

View File

@@ -180,6 +180,7 @@ function setBackupConfig(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if (typeof req.body.provider !== 'string') return next(new HttpError(400, 'provider is required'));
if ('key' in req.body && typeof req.body.key !== 'string') return next(new HttpError(400, 'key must be a string'));
settings.setBackupConfig(req.body, function (error) {
if (error && error.reason === SettingsError.BAD_FIELD) return next(new HttpError(400, error.message));