mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-30 11:18:22 +02:00
feat: automatically 404 if exposeUid or exposeGroupName come up empty
This commit is contained in:
@@ -151,7 +151,12 @@ async function expose(exposedField, method, field, req, res, next) {
|
||||
if (!req.params.hasOwnProperty(field)) {
|
||||
return next();
|
||||
}
|
||||
res.locals[exposedField] = await method(req.params[field]);
|
||||
const value = await method(req.params[field]);
|
||||
if (!value) {
|
||||
next('route');
|
||||
}
|
||||
|
||||
res.locals[exposedField] = value;
|
||||
next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user