feat: new shorthand route /api/v3/users/bySlug/:userslug

closes #8844
This commit is contained in:
Julian Lam
2020-11-06 10:56:18 -05:00
parent 7e273e7710
commit 60e1e99b4f
3 changed files with 16 additions and 1 deletions

View File

@@ -144,7 +144,7 @@ helpers.notAllowed = async function (req, res, error) {
};
helpers.redirect = function (res, url, permanent) {
if (res.locals.isAPI) {
if (res.locals.isAPI && !url.startsWith('/api/v3/')) {
res.set('X-Redirect', encodeURI(url)).status(200).json(url);
} else {
res.redirect(permanent ? 308 : 307, relative_path + encodeURI(url));