improve regex matching in challenge controller
This commit is contained in:
@ -147,12 +147,12 @@ exports.returnCurrentChallenge = function(req, res, next) {
|
||||
exports.returnIndividualChallenge = function(req, res, next) {
|
||||
var dashedName = req.params.challengeName;
|
||||
|
||||
var challengeName = /^(bonfire|waypoint|zipline|basejump)/.test(dashedName) ? dashedName
|
||||
var challengeName = /^(bonfire|waypoint|zipline|basejump)/i.test(dashedName) ? dashedName
|
||||
.replace(/\-/g, ' ')
|
||||
.split(' ')
|
||||
.slice(1)
|
||||
.join(' ')
|
||||
: dashedName;
|
||||
: dashedName.replace(/\-/g, ' ');
|
||||
|
||||
Challenge.find({'name': new RegExp(challengeName, 'i')},
|
||||
function(err, challengeFromMongo) {
|
||||
|
Reference in New Issue
Block a user