Merge pull request #66 from FreeCodeCamp/update-url

update bonfire URL on regex match if incomplete url
This commit is contained in:
Nathan
2015-01-31 17:34:52 -08:00

View File

@ -94,6 +94,10 @@ exports.returnIndividualBonfire = function(req, res, next) {
if (err) {
next(err);
}
var dashedNameFull = bonfire[bonfireNumber].name.toLowerCase().replace(/\s/g, '-');
if (dashedNameFull != dashedName) {
return res.redirect('/bonfires/' + dashedNameFull);
}
if (bonfire.length < 1) {
req.flash('errors', {
msg: "404: We couldn't find a bonfire with that name. Please double check the name."