@@ -1295,7 +1295,7 @@ function urlToOptions(url) {
1295
1295
return options ;
1296
1296
}
1297
1297
1298
- const forwardSlashesRegEx = / \/ + / g;
1298
+ const forwardSlashRegEx = / \/ / g;
1299
1299
1300
1300
function getPathFromURLWin32 ( url ) {
1301
1301
const hostname = url . hostname ;
@@ -1311,7 +1311,7 @@ function getPathFromURLWin32(url) {
1311
1311
}
1312
1312
}
1313
1313
}
1314
- pathname = pathname . replace ( forwardSlashesRegEx , '\\' ) ;
1314
+ pathname = pathname . replace ( forwardSlashRegEx , '\\' ) ;
1315
1315
pathname = decodeURIComponent ( pathname ) ;
1316
1316
if ( hostname !== '' ) {
1317
1317
// If hostname is set, then we have a UNC path
@@ -1336,7 +1336,7 @@ function getPathFromURLPosix(url) {
1336
1336
if ( url . hostname !== '' ) {
1337
1337
throw new ERR_INVALID_FILE_URL_HOST ( platform ) ;
1338
1338
}
1339
- let pathname = url . pathname ;
1339
+ const pathname = url . pathname ;
1340
1340
for ( let n = 0 ; n < pathname . length ; n ++ ) {
1341
1341
if ( pathname [ n ] === '%' ) {
1342
1342
const third = pathname . codePointAt ( n + 2 ) | 0x20 ;
@@ -1347,7 +1347,6 @@ function getPathFromURLPosix(url) {
1347
1347
}
1348
1348
}
1349
1349
}
1350
- pathname = pathname . replace ( forwardSlashesRegEx , '/' ) ;
1351
1350
return decodeURIComponent ( pathname ) ;
1352
1351
}
1353
1352
0 commit comments