From 8b283a9a3c8d874b0b12795a13157639dc0c9f21 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 22 Aug 2016 15:16:50 +0200 Subject: [PATCH] Allow 0-9 in feature and strategy names (#144) --- packages/unleash-api/lib/routes/feature.js | 2 +- packages/unleash-api/lib/routes/strategy.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/unleash-api/lib/routes/feature.js b/packages/unleash-api/lib/routes/feature.js index 59252b8f4e..96ffb51717 100644 --- a/packages/unleash-api/lib/routes/feature.js +++ b/packages/unleash-api/lib/routes/feature.js @@ -30,7 +30,7 @@ module.exports = function (app, config) { app.post('/features', (req, res) => { req.checkBody('name', 'Name is required').notEmpty(); - req.checkBody('name', 'Name must match format ^[a-zA-Z\\.\\-]+$').matches(/^[a-zA-Z\\.\\-]+$/i); + req.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$').matches(/^[0-9a-zA-Z\\.\\-]+$/i); validateRequest(req) .then(validateUniqueName) diff --git a/packages/unleash-api/lib/routes/strategy.js b/packages/unleash-api/lib/routes/strategy.js index 2ee50387b4..8eacc55c0d 100644 --- a/packages/unleash-api/lib/routes/strategy.js +++ b/packages/unleash-api/lib/routes/strategy.js @@ -53,7 +53,7 @@ module.exports = function (app, config) { app.post('/strategies', (req, res) => { req.checkBody('name', 'Name is required').notEmpty(); - req.checkBody('name', 'Name must match format ^[a-zA-Z\\.\\-]+$').matches(/^[a-zA-Z\\.\\-]+$/i); + req.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$').matches(/^[0-9a-zA-Z\\.\\-]+$/i); const newStrategy = req.body;