Skip to content

Commit

Permalink
Add unit tests for Uri.IsWellFormedUri
Browse files Browse the repository at this point in the history
Uri.IsWellFormedUri() reports a false negative when mixing characters
like Å or ตั together with any of the RFC 3986 section 2.2 Reserved
Characters, ! * ' ( ) ; : @ & = + $ , / ? # [ ].

This change adds a (failing) unit test for this bug.

Tests dotnet#21626
  • Loading branch information
Julian Silden Langlo committed Jun 2, 2022
1 parent 2f82cb8 commit 223b9de
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ public void UriIsWellFormed_AbsoluteWithPercentAndColonToRelative_AppendsDotSlas
Assert.True(string.CompareOrdinal(rel.ToString(), 0, "./", 0, 2) == 0, "Cannot have colon in first segment, must append ./");
}

[Fact]
public void UriIsWellFormed_MixedPercent()
{
Assert.True(Uri.IsWellFormedUriString("https://base.com/%C3%A5%2A"));
Assert.True(Uri.IsWellFormedUriString("https://base.com/%E0%B8%95%E0%B8%B1%2A"));
}

[Fact]
public void UriMakeRelative_ImplicitFileCommonBaseWithColon_AppendsDotSlash()
{
Expand Down

0 comments on commit 223b9de

Please sign in to comment.