Skip to content

Commit

Permalink
fixup! Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Oct 18, 2020
1 parent 62c32dc commit e6be5c7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/internal/url.js
Expand Up @@ -1295,7 +1295,7 @@ function urlToOptions(url) {
return options;
}

const forwardSlashesRegEx = /\/+/g;
const forwardSlashRegEx = /\//g;

function getPathFromURLWin32(url) {
const hostname = url.hostname;
Expand All @@ -1311,7 +1311,7 @@ function getPathFromURLWin32(url) {
}
}
}
pathname = pathname.replace(forwardSlashesRegEx, '\\');
pathname = pathname.replace(forwardSlashRegEx, '\\');
pathname = decodeURIComponent(pathname);
if (hostname !== '') {
// If hostname is set, then we have a UNC path
Expand All @@ -1336,7 +1336,7 @@ function getPathFromURLPosix(url) {
if (url.hostname !== '') {
throw new ERR_INVALID_FILE_URL_HOST(platform);
}
let pathname = url.pathname;
const pathname = url.pathname;
for (let n = 0; n < pathname.length; n++) {
if (pathname[n] === '%') {
const third = pathname.codePointAt(n + 2) | 0x20;
Expand All @@ -1347,7 +1347,6 @@ function getPathFromURLPosix(url) {
}
}
}
pathname = pathname.replace(forwardSlashesRegEx, '/');
return decodeURIComponent(pathname);
}

Expand Down

0 comments on commit e6be5c7

Please sign in to comment.