Skip to content
Merged
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
13 changes: 12 additions & 1 deletion src/System.Management.Automation/engine/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,8 +1260,19 @@ internal static bool PathIsUnc(string path)
#if UNIX
return false;
#else
if (string.IsNullOrEmpty(path) || !path.StartsWith('\\'))
{
return false;
}

// handle special cases like \\wsl$\ubuntu which isn't a UNC path, but we can say it is so the filesystemprovider can use it
if (path.StartsWith(@"\\wsl$", StringComparison.OrdinalIgnoreCase))
{
return true;
}

Uri uri;
return !string.IsNullOrEmpty(path) && Uri.TryCreate(path, UriKind.Absolute, out uri) && uri.IsUnc;
return Uri.TryCreate(path, UriKind.Absolute, out uri) && uri.IsUnc;
#endif
}

Expand Down