Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert bad UriBuilder change
  • Loading branch information
GrabYourPitchforks committed May 10, 2022
commit 815bf95d3970e089d73fb58d8ff9602f26504698
10 changes: 5 additions & 5 deletions src/libraries/System.Private.Uri/src/System/UriBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ public UriBuilder(string? scheme, string? host, int port, string? pathValue)
public UriBuilder(string? scheme, string? host, int port, string? path, string? extraValue)
: this(scheme, host, port, path)
{
if (extraValue is not null)
if (!string.IsNullOrEmpty(extraValue))
{
if (extraValue.StartsWith('#'))
if (extraValue[0] == '#')
{
_fragment = extraValue;
}
else if (extraValue.StartsWith('?'))
else if (extraValue[0] == '?')
{
int fragmentIndex = extraValue.IndexOf('#');
if (fragmentIndex < 0)
if (fragmentIndex == -1)
{
_query = extraValue;
}
Expand Down Expand Up @@ -163,7 +163,7 @@ public string Host
get => _host;
set
{
if (!string.IsNullOrEmpty(value) && value[0] != '[' && value.Contains(':'))
if (!string.IsNullOrEmpty(value) && value.Contains(':') && value[0] != '[')
{
//probable ipv6 address - Note: this is only supported for cases where the authority is inet-based.
value = "[" + value + "]";
Expand Down