Skip to content

Commit

Permalink
VP-1249: Fix building Uri for absolute redirect Uri (#371)
Browse files Browse the repository at this point in the history
Checked if store Uri is absolute and handled accordingly;
  • Loading branch information
yecli authored Jan 22, 2020
1 parent fb62d07 commit 877a5d5
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ private string GetStoreAbsoluteUri(string uri)
//Need to build from an host absolute url a relative store-based url
// http://localhost/Account/Login -> http://localhost/{store}/{lang}/Account/Login
var redirectUri = new UriBuilder(uri);
redirectUri.Path = _storefrontUrlBuilder.ToAppAbsolute(redirectUri.Path);
var storeBasedRedirectPath = _storefrontUrlBuilder.ToAppAbsolute(redirectUri.Path);

// Checks whether path is absolute path (starts with scheme), and extract local path if it is
if (Uri.TryCreate(storeBasedRedirectPath, UriKind.Absolute, out var absoluteUri))
{
storeBasedRedirectPath = absoluteUri.AbsolutePath;
}

redirectUri.Path = storeBasedRedirectPath;

return redirectUri.Uri.ToString();
}
}
Expand Down

0 comments on commit 877a5d5

Please sign in to comment.