test: fix path replace

This commit is contained in:
Barış Soner Uşaklı
2024-06-11 17:56:45 -04:00
parent adb0566f48
commit 9ecee78293

View File

@@ -254,7 +254,7 @@ module.exports = function (middleware) {
if (res.locals.isAPI) {
req.params.userslug = lowercaseSlug;
} else {
const newPath = req.path.replace(new RegExp(`/${req.params.userslug}/`), () => `/${lowercaseSlug}/`);
const newPath = req.path.replace(new RegExp(`/${req.params.userslug}`), () => `/${lowercaseSlug}`);
return res.redirect(`${nconf.get('relative_path')}${newPath}`);
}
}