diff options
Diffstat (limited to 'lib/internal/url.js')
-rw-r--r-- | lib/internal/url.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js index 45ed236511..6ad7122b86 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1275,6 +1275,8 @@ function urlToOptions(url) { return options; } +const forwardSlashRegEx = /\//g; + function getPathFromURLWin32(url) { var hostname = url.hostname; var pathname = url.pathname; @@ -1289,6 +1291,7 @@ function getPathFromURLWin32(url) { } } } + pathname = pathname.replace(forwardSlashRegEx, '\\'); pathname = decodeURIComponent(pathname); if (hostname !== '') { // If hostname is set, then we have a UNC path @@ -1297,7 +1300,7 @@ function getPathFromURLWin32(url) { // about percent encoding because the URL parser will have // already taken care of that for us. Note that this only // causes IDNs with an appropriate `xn--` prefix to be decoded. - return `//${domainToUnicode(hostname)}${pathname}`; + return `\\\\${domainToUnicode(hostname)}${pathname}`; } else { // Otherwise, it's a local path that requires a drive letter var letter = pathname.codePointAt(1) | 0x20; |