mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
dont add category/topic slug if user doesnt have read permission
or category is disabled etc.
This commit is contained in:
@@ -188,7 +188,7 @@ categoriesController.get = function(req, res, next) {
|
||||
return helpers.notFound(req, res);
|
||||
}
|
||||
|
||||
if (cid + '/' + req.params.slug !== results.categoryData.slug) {
|
||||
if (req.params.slug && cid + '/' + req.params.slug !== results.categoryData.slug) {
|
||||
return helpers.notFound(req, res);
|
||||
}
|
||||
|
||||
@@ -196,6 +196,10 @@ categoriesController.get = function(req, res, next) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
if (!req.params.slug && results.categoryData.slug && results.categoryData.slug !== cid + '/') {
|
||||
return helpers.redirect(res, '/category/' + encodeURI(results.categoryData.slug));
|
||||
}
|
||||
|
||||
var topicIndex = utils.isNumber(req.params.topic_index) ? parseInt(req.params.topic_index, 10) - 1 : 0;
|
||||
var topicCount = parseInt(results.categoryData.topic_count, 10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user