api: fix validators

This commit is contained in:
Thomas Hobson 2021-02-27 23:10:54 +13:00
parent 3ab6aefe05
commit b91ff42bb8
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
2 changed files with 6 additions and 3 deletions

View File

@ -10,7 +10,8 @@ module.exports = {
body('language')
.isString(), // eslint-disable-line snakecasejs/snakecasejs
body('version')
.isSemVer(), // eslint-disable-line snakecasejs/snakecasejs
.isString(), // eslint-disable-line snakecasejs/snakecasejs
// isSemVer requires it to be a version, not a selector
body('files')
.isArray(), // eslint-disable-line snakecasejs/snakecasejs
body('files.*.name')
@ -20,7 +21,9 @@ module.exports = {
.contains('/'),
body('files.*.content')
.isString(), // eslint-disable-line snakecasejs/snakecasejs
body('*_timeout')
body('compile_timeout')
.isNumeric(), // eslint-disable-line snakecasejs/snakecasejs
body('run_timeout')
.isNumeric(), // eslint-disable-line snakecasejs/snakecasejs
body('stdin')
.isString(), // eslint-disable-line snakecasejs/snakecasejs

View File

@ -52,7 +52,7 @@ module.exports = {
body('url')
.notEmpty() // eslint-disable-line snakecasejs/snakecasejs
.bail()
.isURL({require_protocol: true}) // eslint-disable-line snakecasejs/snakecasejs
.isURL({require_host: false, require_protocol: true, protocols: ['http','https','file']}) // eslint-disable-line snakecasejs/snakecasejs
],
async repo_add(req, res){