Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve error message for policy failures #35633

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! Add readme
  • Loading branch information
Trott committed Oct 18, 2020
commit e6be5c7f15089765f011c5f327e2bc4a82ffd0d9
7 changes: 3 additions & 4 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
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