From 2f525de24c43f5b5293c795ae524005deb543406 Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra Date: Thu, 31 Dec 2020 01:15:25 +0530 Subject: [PATCH] fix(api): validate url before use --- api-server/server/utils/redirection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-server/server/utils/redirection.js b/api-server/server/utils/redirection.js index c93f6fe735..031f61a5d9 100644 --- a/api-server/server/utils/redirection.js +++ b/api-server/server/utils/redirection.js @@ -66,7 +66,7 @@ function getRedirectParams(req, _normalizeParams = normalizeParams) { const url = req.header('Referer'); // since we do not always redirect the user back to the page they were on // we need client locale and origin to construct the redirect url. - const returnUrl = new URL(url); + const returnUrl = new URL(url ? url : homeLocation); const origin = returnUrl.origin; // if this is not one of the client languages, validation will convert // this to '' before it is used.