diff --git a/lib/web/app/redirect.go b/lib/web/app/redirect.go index 70c45fa9a29ea..5b66ee8db2ddf 100644 --- a/lib/web/app/redirect.go +++ b/lib/web/app/redirect.go @@ -78,10 +78,8 @@ const js = ` }).then(response => { if (response.ok) { try { - if (path.charAt(0) !== "/") { - throw "malformed url" - } - window.location.replace(url.origin + path); + var redirectUrl = new URL(path, url.origin) + window.location.replace(redirectUrl.toString()); } catch (error) { // in case of malformed url, return to origin window.location.replace(url.origin)