Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
Co-authored-by: Rich Trott <rtrott@gmail.com>
  • Loading branch information
bmeck and Trott committed Oct 18, 2020
1 parent d313252 commit 62c32dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/internal/url.js
Expand Up @@ -1295,7 +1295,7 @@ function urlToOptions(url) {
return options;
}

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

function getPathFromURLWin32(url) {
const hostname = url.hostname;
Expand All @@ -1311,7 +1311,7 @@ function getPathFromURLWin32(url) {
}
}
}
pathname = pathname.replace(forwardSlashRegEx, '\\');
pathname = pathname.replace(forwardSlashesRegEx, '\\');
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);
}
const pathname = url.pathname;
let pathname = url.pathname;
for (let n = 0; n < pathname.length; n++) {
if (pathname[n] === '%') {
const third = pathname.codePointAt(n + 2) | 0x20;
Expand All @@ -1347,6 +1347,7 @@ function getPathFromURLPosix(url) {
}
}
}
pathname = pathname.replace(forwardSlashesRegEx, '/');
return decodeURIComponent(pathname);
}

Expand Down
5 changes: 5 additions & 0 deletions test/common/README.md
Expand Up @@ -378,6 +378,11 @@ const { spawn } = require('child_process');
spawn(...common.pwdCommand, { stdio: ['pipe'] });
```

### `requireNoPackageJSONAbove()`

Throws an `AssertionError` if a `package.json` file is in any ancestor
directory. Such files may interfere with proper test functionality.

### `runWithInvalidFD(func)`

* `func` [&lt;Function>][]
Expand Down

0 comments on commit 62c32dc

Please sign in to comment.