mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-30 18:46:01 +01:00 
			
		
		
		
	refactor: get rid of RegExp
This commit is contained in:
		| @@ -254,12 +254,8 @@ module.exports = function (middleware) { | ||||
| 			if (res.locals.isAPI) { | ||||
| 				req.params.userslug = lowercaseSlug; | ||||
| 			} else { | ||||
| 				try { | ||||
| 					const newPath = req.path.replace(new RegExp(`/${req.params.userslug}`), () => `/${lowercaseSlug}`); | ||||
| 					return res.redirect(`${nconf.get('relative_path')}${newPath}`); | ||||
| 				} catch (err) { | ||||
| 					next(err); | ||||
| 				} | ||||
| 				const newPath = req.path.replace(`/${req.params.userslug}`, () => `/${lowercaseSlug}`); | ||||
| 				return res.redirect(`${nconf.get('relative_path')}${newPath}`); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user