From 64ac483dddb65ad6cba06a2e2a43a07a361546f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 3 Dec 2020 13:51:22 -0500 Subject: [PATCH] fix: #9032 --- src/controllers/helpers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/helpers.js b/src/controllers/helpers.js index b553fb2d9a..28e53a5914 100644 --- a/src/controllers/helpers.js +++ b/src/controllers/helpers.js @@ -148,14 +148,14 @@ helpers.redirect = function (res, url, permanent) { let redirectUrl; // this is used by sso plugins to redirect to the auth route if (url.hasOwnProperty('external')) { - url.external = encodeURI(url.external); redirectUrl = url.external; + url.external = encodeURI(url.external); } else { - url = encodeURI(url); redirectUrl = url; + url = encodeURI(url); } if (res.locals.isAPI) { - res.set('X-Redirect', redirectUrl).status(200).json(url); + res.set('X-Redirect', encodeURI(redirectUrl)).status(200).json(url); } else { redirectUrl = redirectUrl.startsWith('http://') || redirectUrl.startsWith('https://') ? redirectUrl : relative_path + redirectUrl;