Merge pull request #66 from FreeCodeCamp/update-url
update bonfire URL on regex match if incomplete url
This commit is contained in:
@ -94,6 +94,10 @@ exports.returnIndividualBonfire = function(req, res, next) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
|
var dashedNameFull = bonfire[bonfireNumber].name.toLowerCase().replace(/\s/g, '-');
|
||||||
|
if (dashedNameFull != dashedName) {
|
||||||
|
return res.redirect('/bonfires/' + dashedNameFull);
|
||||||
|
}
|
||||||
if (bonfire.length < 1) {
|
if (bonfire.length < 1) {
|
||||||
req.flash('errors', {
|
req.flash('errors', {
|
||||||
msg: "404: We couldn't find a bonfire with that name. Please double check the name."
|
msg: "404: We couldn't find a bonfire with that name. Please double check the name."
|
||||||
|
Reference in New Issue
Block a user