1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-17 01:17:29 +02:00

Merge pull request #267 from clintabrown/allow_underscore_in_flag

Allow underscores in name validation
This commit is contained in:
Ivar Conradi Østhus 2017-09-19 07:43:04 +02:00 committed by GitHub
commit 4f98f80c61

View File

@ -103,8 +103,8 @@ module.exports.router = function(config) {
router.post('/validate', (req, res) => { router.post('/validate', (req, res) => {
req.checkBody('name', 'Name is required').notEmpty(); req.checkBody('name', 'Name is required').notEmpty();
req req
.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$') .checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-\\_]+$')
.matches(/^[0-9a-zA-Z\\.\\-]+$/i); .matches(/^[0-9a-zA-Z\\.\\-\\_]+$/i);
validateRequest(req) validateRequest(req)
.then(validateUniqueName) .then(validateUniqueName)
@ -115,8 +115,8 @@ module.exports.router = function(config) {
router.post('/', (req, res) => { router.post('/', (req, res) => {
req.checkBody('name', 'Name is required').notEmpty(); req.checkBody('name', 'Name is required').notEmpty();
req req
.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$') .checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-\\_]+$')
.matches(/^[0-9a-zA-Z\\.\\-]+$/i); .matches(/^[0-9a-zA-Z\\.\\-\\_]+$/i);
const userName = extractUser(req); const userName = extractUser(req);
validateRequest(req) validateRequest(req)