| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
|
I think the url label can be removed here? (Also, can you take a look at nodejs/github-bot#115 so that the bot will stop labeling these PRs with url?) |
Sorry, something went wrong.
|
heh, yeah, the bot seems to be a bit aggressive about labeling things these days |
Sorry, something went wrong.
|
New CI: https://ci.nodejs.org/job/node-test-pull-request/5811/ |
Sorry, something went wrong.
There was a problem hiding this comment.
The WHATWG URL parsing could escape the null byte if it's not in the hostname ('\u0000' -> '%00', e.g. new URL('file://hostname/a/b/c\u0000')), thus bypassing the null check, so might worth add a test for it. Is it possible for getPathFromURL to put null bytes in a path without one? If not, maybe the nullCheck can be performed before getPathFromURL.
Sorry, something went wrong.
There was a problem hiding this comment.
good point. it's not just about null bytes, the path could contain any number of pct-encoded characters. This should run the path through a decode before returning... will fix that
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, that can be a problem for files with non-ASCII names...might worth add a test for something like 'file://hostname/文件.txt'.
Sorry, something went wrong.
There was a problem hiding this comment.
Also, the hostname can be escaped by domain to ASCII too. Like 'file://你好你好/a/b'
Sorry, something went wrong.
There was a problem hiding this comment.
Why not path.codePointAt(0)? Or path.startsWith('file://')?
Sorry, something went wrong.
There was a problem hiding this comment.
Maybe this can be moved into the else if (path instanceof URL) block, because a path that starts with file://(isFileUrl ) will have the file protocol.
Sorry, something went wrong.
Sorry, something went wrong.
|
sigh... lol... obvious that last run was less than successful ;-) ... will investigate later on tonight |
Sorry, something went wrong.
Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [nodejs#11029](nodejs#11029)
* upgrade libuv to 1.11.0 (cjihrig) [nodejs#11094](nodejs#11094)
* add node-inspect 1.10.4 (Jan Krems) [nodejs#10187](nodejs#10187)
* upgrade zlib to 1.2.11 (Sam Roberts) [nodejs#10980](nodejs#10980)
* lib: build `node inspect` into `node` (Anna Henningsen) [nodejs#10187](nodejs#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [nodejs#9469](nodejs#9469)
* inspector: add --inspect-brk (Josh Gavant) [nodejs#11149](nodejs#11149)
* fs: allow WHATWG URL objects as paths (James M Snell) [nodejs#10739](nodejs#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [nodejs#11129](nodejs#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [nodejs#10857](nodejs#10857)
PR-URL: nodejs#11185
Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [nodejs#11029](nodejs#11029)
* upgrade libuv to 1.11.0 (cjihrig) [nodejs#11094](nodejs#11094)
* add node-inspect 1.10.4 (Jan Krems) [nodejs#10187](nodejs#10187)
* upgrade zlib to 1.2.11 (Sam Roberts) [nodejs#10980](nodejs#10980)
* lib: build `node inspect` into `node` (Anna Henningsen) [nodejs#10187](nodejs#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [nodejs#9469](nodejs#9469)
* inspector: add --inspect-brk (Josh Gavant) [nodejs#11149](nodejs#11149)
* fs: allow WHATWG URL objects as paths (James M Snell) [nodejs#10739](nodejs#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [nodejs#11129](nodejs#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [nodejs#10857](nodejs#10857)
PR-URL: nodejs#11185
Updates the fs module APIs to allow 'file://' URL objects
to be passed as the path.
For example:
```js
const URL = require('url').URL;
const myURL = new URL('file:///C:/path/to/file');
fs.readFile(myURL, (err, data) => {});
```
On Windows, file: URLs with a hostname convert to UNC paths,
while file: URLs with drive letters convert to local absolute
paths:
```
file://hostname/a/b/c => \\hostname\a\b\c
file:///c:/a/b/c => c:\a\b\c
```
On all other platforms, file: URLs with a hostname are unsupported
and will result in a throw:
```
file://hostname/a/b/c => throw!
file:///a/b/c => /a/b/c
```
The documentation for the fs API is intentionally not updated in
this commit because the URL API is still considered experimental
and is not officially documented *at this time*
Note that file: URLs are *required* by spec to always be absolute
paths from the file system root.
This is a semver-major commit because it changes error handling
on the fs APIs.
PR-URL: nodejs#10739
Ref: nodejs#10703
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Updates the fs module APIs to allow 'file://' URL objects
to be passed as the path.
For example:
```js
const URL = require('url').URL;
const myURL = new URL('file:///C:/path/to/file');
fs.readFile(myURL, (err, data) => {});
```
On Windows, file: URLs with a hostname convert to UNC paths,
while file: URLs with drive letters convert to local absolute
paths:
```
file://hostname/a/b/c => \\hostname\a\b\c
file:///c:/a/b/c => c:\a\b\c
```
On all other platforms, file: URLs with a hostname are unsupported
and will result in a throw:
```
file://hostname/a/b/c => throw!
file:///a/b/c => /a/b/c
```
The documentation for the fs API is intentionally not updated in
this commit because the URL API is still considered experimental
and is not officially documented *at this time*
Note that file: URLs are *required* by spec to always be absolute
paths from the file system root.
This is a semver-major commit because it changes error handling
on the fs APIs.
PR-URL: nodejs#10739
Ref: nodejs#10703
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Notable changes:
* deps:
* update V8 to 5.5 (Michaël Zasso) [#11029](nodejs/node#11029)
* upgrade libuv to 1.11.0 (cjihrig) [#11094](nodejs/node#11094)
* add node-inspect 1.10.4 (Jan Krems) [#10187](nodejs/node#10187)
* upgrade zlib to 1.2.11 (Sam Roberts) [#10980](nodejs/node#10980)
* lib: build `node inspect` into `node` (Anna Henningsen) [#10187](nodejs/node#10187)
* crypto: Remove expired certs from CNNIC whitelist (Shigeki Ohtsu) [#9469](nodejs/node#9469)
* inspector: add --inspect-brk (Josh Gavant) [#11149](nodejs/node#11149)
* fs: allow WHATWG URL objects as paths (James M Snell) [#10739](nodejs/node#10739)
* src: support UTF-8 in compiled-in JS source files (Ben Noordhuis) [#11129](nodejs/node#11129)
* url: extend url.format to support WHATWG URL (James M Snell) [#10857](nodejs/node#10857)
PR-URL: nodejs/node#11185
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
|
@addaleax said:
but I didn't see any follow up comments. Why is this not documented? I just found it while browsing the fs source. |
Sorry, something went wrong.
|
@sam-github Quoting the PR description (I think this had been added later):
|
Sorry, something went wrong.
|
I see. We can't document that fs APIs take a url.URL object when url.URL itself is undocumented. Fair enough. |
Sorry, something went wrong.
|
To be fair, url.URL has been documented since this PR landed: https://nodejs.org/api/url.html#url_the_whatwg_url_api. I’ll open a good first contribution issue asking for docs for this feature. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Updates the fs module APIs to allow 'file://' URL strings and WHATWG URL objects using 'file:' protocol to be passed as the path.
For example:
On Windows, file: URLs with a hostname convert to UNC paths, while file: URLs with drive letters convert to local absolute paths:
On all other platforms, file: URLs with a hostname are unsupported and will result in a throw:
The documentation for the fs API is intentionally not updated in this commit because the URL API is still considered experimental and is not officially documented at this time
Note that file: URLs are required by spec to always be absolute paths from the file system root.
This is a semver-major commit because it changes error handling on the fs APIs.
Refs: #10703
Checklist
Affected core subsystem(s)
fs, url