From 9818186afc8441289c5dbf2c53770e0606a734bf Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 26 Jun 2015 00:16:18 -0700 Subject: [PATCH] fix should redirect to /news when no story is found --- server/boot/story.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/boot/story.js b/server/boot/story.js index c3e9defaae..9db6bfb1a8 100755 --- a/server/boot/story.js +++ b/server/boot/story.js @@ -168,15 +168,15 @@ module.exports = function(app) { msg: "404: We couldn't find a story with that name. " + 'Please double check the name.' }); + return res.redirect('/news'); + } - var dashedNameFull = story.storyLink.toLowerCase() - .replace(/\s+/g, ' ') - .replace(/\s/g, '-'); + var dashedNameFull = story.storyLink.toLowerCase() + .replace(/\s+/g, ' ') + .replace(/\s/g, '-'); - if (dashedNameFull !== dashedName) { - return res.redirect('../stories/' + dashedNameFull); - } - return res.redirect('/stories/'); + if (dashedNameFull !== dashedName) { + return res.redirect('../stories/' + dashedNameFull); } var username = req.user ? req.user.username : '';