From b4084aa705fc6da4b0bfd9688a17421c02a12c2b Mon Sep 17 00:00:00 2001 From: Clint Brown Date: Tue, 19 Sep 2017 14:37:23 +1000 Subject: [PATCH] Allow underscores in name validation --- lib/routes/admin-api/feature.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/routes/admin-api/feature.js b/lib/routes/admin-api/feature.js index b1cc0f3221..6056a238e8 100644 --- a/lib/routes/admin-api/feature.js +++ b/lib/routes/admin-api/feature.js @@ -103,8 +103,8 @@ module.exports.router = function(config) { router.post('/validate', (req, res) => { req.checkBody('name', 'Name is required').notEmpty(); req - .checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$') - .matches(/^[0-9a-zA-Z\\.\\-]+$/i); + .checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-\\_]+$') + .matches(/^[0-9a-zA-Z\\.\\-\\_]+$/i); validateRequest(req) .then(validateUniqueName) @@ -115,8 +115,8 @@ module.exports.router = function(config) { router.post('/', (req, res) => { req.checkBody('name', 'Name is required').notEmpty(); req - .checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$') - .matches(/^[0-9a-zA-Z\\.\\-]+$/i); + .checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-\\_]+$') + .matches(/^[0-9a-zA-Z\\.\\-\\_]+$/i); const userName = extractUser(req); validateRequest(req)