Skip to content

Commit

Permalink
handle bad language url
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Sep 20, 2012
1 parent 3fe42de commit 2f115e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions routes/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ exports.index = function(req, res, next){
*/

exports.lang = function (req, res, next) {
var lang = req.param('lang');
var lang = req.param('lang') || '';

// if nothing submitted, nothing to do
if (!(lang= lang.trim())) return next();
if (!(lang= lang.trim())) {
return res.redirect('/');
}

// handle missing language in github
if ('null' === lang) lang = null;
Expand Down
2 changes: 1 addition & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = exports = function (app) {

app.get('/', home.index);
app.get('/users', user.list);
app.get('/language/:lang', home.lang)
app.get('/language/:lang?', home.lang)
app.get('/search/:term?', home.search)

}

0 comments on commit 2f115e0

Please sign in to comment.