Support forward slashes in network share (UNC path) completion (#17111) (#17117)

This commit is contained in:
Stéphane BARIZIEN authored and GitHub committed 2022-04-12 21:00:16 +05:00
1 parent 7cc9c87473
commit 4acf6b39d4
2 files changed
+15 -4

No files matched your search

@@ -4301,7 +4301,8 @@ namespace System.Management.Automation
var results = new List<CompletionResult>();
// First, try to match \\server\share
var shareMatch = Regex.Match(wordToComplete, "^\\\\\\\\([^\\\\]+)\\\\([^\\\\]*)$");
// support both / and \ when entering UNC paths for typing convenience (#17111)
var shareMatch = Regex.Match(wordToComplete, @"^(?:\\\\|//)([^\\/]+)(?:\\|/)([^\\/]*)$");
if (shareMatch.Success)
{
// Only match share names, no filenames.