fix: redirect correctly in development (#40594)

* fix: redirect correctly in development

* fix: prevent // appearing in path

* refactor: remove old comments

* fix: remove trailing slash for redirection
This commit is contained in:
Oliver Eyton-Williams
2021-01-06 01:49:56 +01:00
committed by Mrugesh Mohapatra
parent 49b1c29f6b
commit 77022b8a56
2 changed files with 5 additions and 6 deletions

View File

@ -23,7 +23,6 @@ function getReturnTo(encryptedParams, secret, _homeLocation = homeLocation) {
return normalizeParams(params, _homeLocation);
}
// TODO: tests!
function normalizeParams(
{ returnTo, origin, pathPrefix },
_homeLocation = homeLocation
@ -59,9 +58,6 @@ function getRedirectBase(origin, pathPrefix) {
return `${origin}${redirectPathSegment}`;
}
// TODO: this might be cleaner if we just use a URL for returnTo (call it
// returnURL for clarity) rather than pulling out origin and returning it
// separately
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