Skip to content
Permalink
Browse files

Display 404 page if tag does not exist.

closes #2667
- if tag result is '' 404 instead of rendering an empty page
- added test for /tag/asdf should 404
  • Loading branch information...
shindakun committed May 12, 2014
1 parent 10759ed commit eb2fdc44fb26ded76b22b627cc1dec13789431c5
Showing with 12 additions and 1 deletion.
  1. +4 −0 core/server/controllers/frontend.js
  2. +8 −1 core/test/functional/frontend/error_test.js
@@ -133,6 +133,10 @@ frontendControllers = {
tag: page.meta.filters.tags ? page.meta.filters.tags[0] : ''
});

// If the resulting tag is '' then 404.
if (!result.tag) {
return next();
}
res.render(view, result);
});
});
@@ -14,4 +14,11 @@ CasperTest.begin('Check frontend route not found (404)', 2, function suite(test)
test.assertEqual(response.status, 404, 'Response status should be 404.');
test.assertSelectorHasText('.error-code', '404');
});
}, true);
}, true);

CasperTest.begin('Check frontend tag route not found (404)', 2, function suite(test) {
casper.thenOpen(url + 'tag/asdf/', function (response) {
test.assertEqual(response.status, 404, 'Response status should be 404.');
test.assertSelectorHasText('.error-code', '404');
});
}, true);

0 comments on commit eb2fdc4

Please sign in to comment.
You can’t perform that action at this time.