mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Allow 0-9 in feature and strategy names (#144)
This commit is contained in:
		
							parent
							
								
									fb767f2b4a
								
							
						
					
					
						commit
						8b283a9a3c
					
				@ -30,7 +30,7 @@ module.exports = function (app, config) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    app.post('/features', (req, res) => {
 | 
					    app.post('/features', (req, res) => {
 | 
				
			||||||
        req.checkBody('name', 'Name is required').notEmpty();
 | 
					        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)
 | 
					        validateRequest(req)
 | 
				
			||||||
            .then(validateUniqueName)
 | 
					            .then(validateUniqueName)
 | 
				
			||||||
 | 
				
			|||||||
@ -53,7 +53,7 @@ module.exports = function (app, config) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    app.post('/strategies', (req, res) => {
 | 
					    app.post('/strategies', (req, res) => {
 | 
				
			||||||
        req.checkBody('name', 'Name is required').notEmpty();
 | 
					        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;
 | 
					        const newStrategy = req.body;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user