mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
removed checks that would send the user to 404 if the slug didn't match, restored old behaviour of redirecting to the correct slug. #3047
This commit is contained in:
@@ -188,15 +188,11 @@ categoriesController.get = function(req, res, next) {
|
||||
return helpers.notFound(req, res);
|
||||
}
|
||||
|
||||
if (req.params.slug && cid + '/' + req.params.slug !== results.categoryData.slug) {
|
||||
return helpers.notFound(req, res);
|
||||
}
|
||||
|
||||
if (!results.privileges.read) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
if (!req.params.slug && results.categoryData.slug && results.categoryData.slug !== cid + '/') {
|
||||
if ((!req.params.slug || results.categoryData.slug !== cid + '/' + req.params.slug) && (results.categoryData.slug && results.categoryData.slug !== cid + '/')) {
|
||||
return helpers.redirect(res, '/category/' + encodeURI(results.categoryData.slug));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,15 +43,11 @@ topicsController.get = function(req, res, next) {
|
||||
function (results, next) {
|
||||
userPrivileges = results.privileges;
|
||||
|
||||
if (userPrivileges.disabled || (req.params.slug && tid + '/' + req.params.slug !== results.topic.slug)) {
|
||||
return helpers.notFound(req, res);
|
||||
}
|
||||
|
||||
if (!userPrivileges.read || (parseInt(results.topic.deleted, 10) && !userPrivileges.view_deleted)) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
if (!req.params.slug && results.topic.slug && results.topic.slug !== tid + '/') {
|
||||
if ((!req.params.slug || results.topic.slug !== tid + '/' + req.params.slug) && (results.topic.slug && results.topic.slug !== tid + '/')) {
|
||||
return helpers.redirect(res, '/topic/' + encodeURI(results.topic.slug));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user