Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Umbraco.Core/Routing/UriUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ public Uri UriToUmbraco(Uri uri)
if (path != "/")
{
path = path.TrimEnd(Constants.CharArrays.ForwardSlash);

// perform fallback to root if the path was all slashes (i.e. https://some.where//////)
if (path == string.Empty)
{
path = "/";
}
}

return uri.Rewrite(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public class UriUtilityTests

// test that the trailing slash goes but not on hostname
[TestCase("http://LocalHost/", "http://localhost/")]
[TestCase("http://LocalHost/////", "http://localhost/")]
[TestCase("http://LocalHost/Home/", "http://localhost/home")]
[TestCase("http://LocalHost/Home/////", "http://localhost/home")]
[TestCase("http://LocalHost/Home/?x=y", "http://localhost/home?x=y")]
[TestCase("http://LocalHost/Home/Sub1/", "http://localhost/home/sub1")]
[TestCase("http://LocalHost/Home/Sub1/?x=y", "http://localhost/home/sub1?x=y")]
Expand Down