Skip to content
Draft
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
2 changes: 1 addition & 1 deletion src/libraries/System.Private.Uri/src/System/Uri.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ public override int GetHashCode()

string remoteUrl = info.RemoteUrl ??= GetParts(components, UriFormat.SafeUnescaped);

if (IsUncOrDosPath)
if (IsFile)
{
return StringComparer.OrdinalIgnoreCase.GetHashCode(remoteUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ public static IEnumerable<object[]> Equals_TestData()
yield return new object[] { new Uri("file://C:/path1/path2/file"), new Uri("http://domain.com"), false };
yield return new object[] { new Uri("file://C:/path1/path2/file"), new Uri(@"\\server\path1\path2\file"), false };

// UNC paths that normalize to the same value as a regular file: URI
yield return new object[] { new Uri("\\\\\u202a"), new Uri("file:///"), true };

// UNC share paths
yield return new object[] { new Uri(@"\\server\sharepath\path\file"), new Uri(@"\\server\sharepath\path\file"), true };
yield return new object[] { new Uri(@"\\server\sharepath\path\file"), new Uri(@"\\server1\sharepath\path\file"), false };
Expand Down
Loading