@@ -1295,7 +1295,7 @@ function urlToOptions(url) {
12951295 return options ;
12961296}
12971297
1298- const forwardSlashesRegEx = / \/ + / g;
1298+ const forwardSlashRegEx = / \/ / g;
12991299
13001300function getPathFromURLWin32 ( url ) {
13011301 const hostname = url . hostname ;
@@ -1311,7 +1311,7 @@ function getPathFromURLWin32(url) {
13111311 }
13121312 }
13131313 }
1314- pathname = pathname . replace ( forwardSlashesRegEx , '\\' ) ;
1314+ pathname = pathname . replace ( forwardSlashRegEx , '\\' ) ;
13151315 pathname = decodeURIComponent ( pathname ) ;
13161316 if ( hostname !== '' ) {
13171317 // If hostname is set, then we have a UNC path
@@ -1336,7 +1336,7 @@ function getPathFromURLPosix(url) {
13361336 if ( url . hostname !== '' ) {
13371337 throw new ERR_INVALID_FILE_URL_HOST ( platform ) ;
13381338 }
1339- let pathname = url . pathname ;
1339+ const pathname = url . pathname ;
13401340 for ( let n = 0 ; n < pathname . length ; n ++ ) {
13411341 if ( pathname [ n ] === '%' ) {
13421342 const third = pathname . codePointAt ( n + 2 ) | 0x20 ;
@@ -1347,7 +1347,6 @@ function getPathFromURLPosix(url) {
13471347 }
13481348 }
13491349 }
1350- pathname = pathname . replace ( forwardSlashesRegEx , '/' ) ;
13511350 return decodeURIComponent ( pathname ) ;
13521351}
13531352
0 commit comments