Skip to content

Node.js based forum software built for the modern web

fix: #9698, pass along query params in redirect

Barış Soner Uşaklı9de64bf51623
diff --git a/src/controllers/write/users.js b/src/controllers/write/users.js
index 222d664032..43aa2c0ccc 100644
--- a/src/controllers/write/users.js
+++ b/src/controllers/write/users.js
@@ -27,7 +27,8 @@ Users.redirectBySlug = async (req, res) => {
if (uid) {
const path = req.path.split('/').slice(3).join('/');
- res.redirect(308, nconf.get('relative_path') + encodeURI(`/api/v3/users/${uid}/${path}`));
+ const urlObj = new URL(nconf.get('url') + req.url);
+ res.redirect(308, nconf.get('relative_path') + encodeURI(`/api/v3/users/${uid}/${path}${urlObj.search}`));
} else {
helpers.formatApiResponse(404, res);
}