mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 15:30:39 +01:00
fix: #9670 return 4xx errors instead of 5xx on flag routes, when unauthenticated or not privileged [breaking]
This commit is contained in:
@@ -117,11 +117,7 @@ helpers.buildTerms = function (url, term, query) {
|
||||
};
|
||||
|
||||
helpers.notAllowed = async function (req, res, error) {
|
||||
const data = await plugins.hooks.fire('filter:helpers.notAllowed', {
|
||||
req: req,
|
||||
res: res,
|
||||
error: error,
|
||||
});
|
||||
({ error } = await plugins.hooks.fire('filter:helpers.notAllowed', { req, res, error }));
|
||||
|
||||
if (req.loggedIn || req.uid === -1) {
|
||||
if (res.locals.isAPI) {
|
||||
@@ -132,7 +128,7 @@ helpers.notAllowed = async function (req, res, error) {
|
||||
res.status(403).render('403', {
|
||||
path: req.path,
|
||||
loggedIn: req.loggedIn,
|
||||
error: data.error,
|
||||
error,
|
||||
title: '[[global:403.title]]',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user