mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-27 17:11:14 +01:00
fix: #13011, catch errors
This commit is contained in:
@@ -254,8 +254,12 @@ module.exports = function (middleware) {
|
|||||||
if (res.locals.isAPI) {
|
if (res.locals.isAPI) {
|
||||||
req.params.userslug = lowercaseSlug;
|
req.params.userslug = lowercaseSlug;
|
||||||
} else {
|
} else {
|
||||||
const newPath = req.path.replace(new RegExp(`/${req.params.userslug}`), () => `/${lowercaseSlug}`);
|
try {
|
||||||
return res.redirect(`${nconf.get('relative_path')}${newPath}`);
|
const newPath = req.path.replace(new RegExp(`/${req.params.userslug}`), () => `/${lowercaseSlug}`);
|
||||||
|
return res.redirect(`${nconf.get('relative_path')}${newPath}`);
|
||||||
|
} catch (err) {
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user