fix: #8549 send 308 Permanent Redirect on topic/category shortlinks

This commit is contained in:
Julian Lam
2020-08-06 10:48:35 -04:00
parent def16f9e97
commit 68f8d6e3a1
3 changed files with 4 additions and 4 deletions

View File

@@ -151,11 +151,11 @@ helpers.notAllowed = async function (req, res, error) {
}
};
helpers.redirect = function (res, url) {
helpers.redirect = function (res, url, permanent) {
if (res.locals.isAPI) {
res.set('X-Redirect', encodeURI(url)).status(200).json(url);
} else {
res.redirect(nconf.get('relative_path') + encodeURI(url));
res.redirect(permanent ? 308 : 307, nconf.get('relative_path') + encodeURI(url));
}
};