diff --git a/core/server/controllers/frontend.js b/core/server/controllers/frontend.js index 9ff45a4d05..11a288b155 100644 --- a/core/server/controllers/frontend.js +++ b/core/server/controllers/frontend.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); }); }); diff --git a/core/test/functional/frontend/error_test.js b/core/test/functional/frontend/error_test.js index 670a095b05..98c472325b 100644 --- a/core/test/functional/frontend/error_test.js +++ b/core/test/functional/frontend/error_test.js @@ -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); \ No newline at end of file +}, 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);