url: handle windows drive letter in the file state#12808
url: handle windows drive letter in the file state#12808watilde wants to merge 1 commit intonodejs:masterfrom
Conversation
|
Oops! It looks like you copied other tests ... which was already in your tests file. Correct ones are commented |
|
Opps sorry! I re-copied them and got an error in {
"input": "C|",
"base": "file://host/dir/file",
"href": "file:///C:",
"protocol": "file:",
"username": "",
"password": "",
"host": "",
"hostname": "",
"port": "",
"pathname": "/C:",
"search": "",
"hash": ""
},I will work on it tonight. Thanks for pointing it :) @rmisev |
|
CI: https://ci.nodejs.org/job/node-test-commit/9600/ |
src/node_url.cc
Outdated
There was a problem hiding this comment.
The remaining means after ch, so p[0] must not be counted here. Correct to end - (p+1) == 0 or just end - p == 1
There is an example, which explains the term remaining: https://url.spec.whatwg.org/#remaining
There was a problem hiding this comment.
I see it works! Thanks for your comment :)
src/node_url.cc
Outdated
There was a problem hiding this comment.
The same as above: end - (p+1) >= 2 or just end - p >= 3
|
The last CI doesn’t look so good… :/ |
|
@addaleax Yeah sorry, I was WIP at the time without the |
|
Okay, new CI then: https://ci.nodejs.org/job/node-test-commit/9608/ :) |
src/node_url.cc
Outdated
There was a problem hiding this comment.
Depending on the spec writer's intention (whatwg/url#308) changing end - p == 1 to end - p <= 1 might be more robust to cover ch == kEOL as well, but in any case it shouldn't matter since the case when ch == kEOL is covered in another case already. Also, nice catch on noticing the end - p == 1 in the original code should actually be end - p == 2 👍
There was a problem hiding this comment.
Seems like they agree with me.
We can also calculate per iteration an actual remaining variable, like we are already doing for some other functions in the file. This should eliminate any confusion around this variable. The most correct implementation would be something like const size_t remaining = end == pointer ? 0 : (end - pointer - 1);.
There was a problem hiding this comment.
Woo that'd be nice! I'm going to update it 😺
it's gonna be like
const size_t remaining = end == pointer ? 0 : (end - pointer - 1);
......
if ((remaining == 0 ||
!IsWindowsDriveLetter(ch, p[1]) ||
(remaining >= 2 &&
p[2] != '/' &&
p[2] != '\\' &&
p[2] != '?' &&
p[2] != '#'))) {There was a problem hiding this comment.
I replaced end - pointer with remaining I added.
`C|` should not satisfy the condition to not copy the base's path. It also synchronises WPT url test data to verify the update in upstream. Refs: whatwg/url#305 Refs: web-platform-tests/wpt#5754
|
Landed in 943dd5f. |
`C|` should not satisfy the condition to not copy the base's path. It also synchronises WPT url test data to verify the update in upstream. PR-URL: #12808 Refs: whatwg/url#305 Refs: web-platform-tests/wpt#5754 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
`C|` should not satisfy the condition to not copy the base's path. It also synchronises WPT url test data to verify the update in upstream. PR-URL: nodejs#12808 Refs: whatwg/url#305 Refs: web-platform-tests/wpt#5754 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
`C|` should not satisfy the condition to not copy the base's path. It also synchronises WPT url test data to verify the update in upstream. PR-URL: nodejs#12808 Refs: whatwg/url#305 Refs: web-platform-tests/wpt#5754 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
`C|` should not satisfy the condition to not copy the base's path. It also synchronises WPT url test data to verify the update in upstream. PR-URL: #12808 Refs: whatwg/url#305 Refs: web-platform-tests/wpt#5754 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
In the
whatwg-url,C|should not satisfy the condition to not copy the base's path. This patch also synchronises WPT url test data to verify the update in upstream.Refs: whatwg/url#305
Refs: web-platform-tests/wpt#5754
Checklist
make -j4 testAffected core subsystem(s)
url