Skip to content

Commit 87f66a7

Browse files
cdbullardMihaZupan
andauthored
Update src/libraries/System.Private.Uri/src/System/UriBuilder.cs
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
1 parent e9b4d92 commit 87f66a7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libraries/System.Private.Uri/src/System/UriBuilder.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ private static string EncodeUserInfo(string? input)
262262
return string.Empty;
263263
}
264264

265+
// The following characters ("/" / "\" / "?" / "#" / "@") are from the gen-delims group.
266+
// We have to escape them to avoid corrupting the rest of the Uri string.
267+
// Other characters like spaces or non-ASCII will be escaped by Uri, we can ignore them here.
265268
if (input.AsSpan().IndexOfAny(@"/\?#@") < 0)
266269
{
267270
return input;

0 commit comments

Comments
 (0)