File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,8 +55,13 @@ export function normalizePath(p: string): string {
5555
5656 // Handle double backslashes, preserving leading UNC \\
5757 if ( p . startsWith ( '\\\\' ) ) {
58- // For UNC paths, normalize double backslashes *after* the leading marker
59- const restOfPath = p . substring ( 2 ) . replace ( / \\ \\ / g, '\\' ) ;
58+ // For UNC paths, first normalize any excessive leading backslashes to exactly \\
59+ // Then normalize double backslashes in the rest of the path
60+ let uncPath = p ;
61+ // Replace multiple leading backslashes with exactly two
62+ uncPath = uncPath . replace ( / ^ \\ { 2 , } / , '\\\\' ) ;
63+ // Now normalize any remaining double backslashes in the rest of the path
64+ const restOfPath = uncPath . substring ( 2 ) . replace ( / \\ \\ / g, '\\' ) ;
6065 p = '\\\\' + restOfPath ;
6166 } else {
6267 // For non-UNC paths, normalize all double backslashes
You can’t perform that action at this time.
0 commit comments