diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs index e5ee3e8fec49f0..81f2e063a847e1 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/Path.Windows.cs @@ -89,7 +89,7 @@ public static string GetFullPath(string path, string basePath) // Drive relative paths Debug.Assert(length == 2 || !PathInternal.IsDirectorySeparator(path[2])); - if (GetVolumeName(path.AsSpan()).EqualsOrdinal(GetVolumeName(basePath.AsSpan()))) + if (GetVolumeName(path.AsSpan()).EqualsOrdinalIgnoreCase(GetVolumeName(basePath.AsSpan()))) { // Matching root // "C:Foo" and "C:\Bar" => "C:\Bar\Foo" @@ -349,8 +349,8 @@ internal static int GetUncRootLength(ReadOnlySpan path) if (!isDevice && path.Slice(0, 2).EqualsOrdinal(@"\\".AsSpan())) return 2; else if (isDevice && path.Length >= 8 - && (path.Slice(0, 8).EqualsOrdinal(PathInternal.UncExtendedPathPrefix.AsSpan()) - || path.Slice(5, 4).EqualsOrdinal(@"UNC\".AsSpan()))) + && (path.Slice(0, 8).EqualsOrdinalIgnoreCase(PathInternal.UncExtendedPathPrefix.AsSpan()) + || path.Slice(5, 4).EqualsOrdinalIgnoreCase(@"UNC\".AsSpan()))) return 8; return -1; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests_Windows.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests_Windows.cs index f1b27f9fef81f6..46d7bf01c4ecae 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests_Windows.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests_Windows.cs @@ -563,6 +563,8 @@ public void GetFullPath_CommonDevice_Windows(string path, string basePath, strin { @"C:tmp", @"C:\git\runtime", @"C:\git\runtime\tmp" }, { @"C:", @"C:\git\runtime", @"C:\git\runtime" }, { @"C", @"C:\git\runtime", @"C:\git\runtime\C" }, + { @"c:", @"C:\git\runtime", @"C:\git\runtime" }, + { @"C:tmp", @"c:\git\runtime", @"c:\git\runtime\tmp" }, { @"Z:tmp\foo\..", @"C:\git\runtime", @"Z:\tmp" }, { @"Z:tmp\foo\.", @"C:\git\runtime", @"Z:\tmp\foo" },