Check type of bucket and prefix as well

This commit is contained in:
Girish Ramakrishnan
2016-10-09 20:17:22 -07:00
parent 26c67d2d36
commit 4e3ba4c96f

View File

@@ -395,6 +395,8 @@ function setBackupConfig(backupConfig, callback) {
} else if (backupConfig.provider === 's3') {
if (typeof backupConfig.accessKeyId !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'accessKeyId must be a string'));
if (typeof backupConfig.secretAccessKey !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'secretAccessKey must be a string'));
if (typeof backupConfig.bucket !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'bucket must be a string'));
if (typeof backupConfig.prefix !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'prefix must be a string'));
}
settingsdb.set(exports.BACKUP_CONFIG_KEY, JSON.stringify(backupConfig), function (error) {