From e6be5c7f15089765f011c5f327e2bc4a82ffd0d9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 18 Oct 2020 06:13:35 -0700 Subject: [PATCH] fixup! Add readme --- lib/internal/url.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index 7f2277c474e235..3c464ffbd638f6 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1295,7 +1295,7 @@ function urlToOptions(url) { return options; } -const forwardSlashesRegEx = /\/+/g; +const forwardSlashRegEx = /\//g; function getPathFromURLWin32(url) { const hostname = url.hostname; @@ -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 @@ -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; @@ -1347,7 +1347,6 @@ function getPathFromURLPosix(url) { } } } - pathname = pathname.replace(forwardSlashesRegEx, '/'); return decodeURIComponent(pathname); }