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

url: trim leading slashes of file URL paths #12203

Closed
wants to merge 1 commit into from

Conversation

@watilde
Copy link
Member

commented Apr 4, 2017

It should trim the slashes after the colon into three for file URL.

Resources:

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests are included
  • commit message follows [commit guidelines][]
Affected core subsystem(s)

url

"search": "",
"hash": ""
},
// {

This comment has been minimized.

Copy link
@thefourtheye

thefourtheye Apr 4, 2017

Contributor

Is this commented text necessary?

This comment has been minimized.

Copy link
@watilde

watilde Apr 4, 2017

Author Member

This additional is to follow the spec/test updates(web-platform-tests/wpt#5195), and we're still having some remaining unfollowed updates of the spec. When we follow them that can fix this test cases, we can take the comment out.

e.g.

// {
// "href": "file://test/",
// "new_value": "test",
// "expected": {
// "href": "file://test/",
// "username": ""
// }
// }

I will work on it later, but I think it's better to separate a patch from this PR since the referral link can be different.

(ch == kEOL ||
ch == '?' ||
ch == '#')) {
while (url->path.size() > 1 && url->path[0].length() == 0) {

This comment has been minimized.

Copy link
@thefourtheye

thefourtheye Apr 4, 2017

Contributor

Did you mean > 0 here?

This comment has been minimized.

Copy link
@watilde
@watilde

This comment has been minimized.

Copy link
Member Author

commented Apr 5, 2017

@watilde

This comment has been minimized.

Copy link
Member Author

commented Apr 5, 2017

@TimothyGu
Copy link
Member

left a comment

Almost there.

src/node_url.cc Outdated
url->flags |= URL_FLAGS_HAS_PATH;
url->path.push_back(base->path[0]);
if (NORMALIZED_WINDOWS_DRIVE_LETTER(base->path[0])) {

This comment has been minimized.

Copy link
@TimothyGu

TimothyGu Apr 6, 2017

Member

The url->flags |= URL_FLAGS_HAS_PATH; should go into this branch.

This comment has been minimized.

Copy link
@watilde

watilde Apr 7, 2017

Author Member

Thanks! The flags seem to be there around passing a value to the property.

Updates :)

src/node_url.cc Outdated
url->path.push_back(base->path[0]);
if (NORMALIZED_WINDOWS_DRIVE_LETTER(base->path[0])) {
url->path.push_back(base->path[0]);
} else {

This comment has been minimized.

Copy link
@TimothyGu

TimothyGu Apr 6, 2017

Member

And this branch needs a url->flags |= URL_FLAGS_HAS_HOST;

@watilde watilde force-pushed the watilde:feature/file-slash-2 branch Apr 7, 2017

@watilde

This comment has been minimized.

Copy link
Member Author

commented Apr 7, 2017

@@ -1620,6 +1620,33 @@ module.exports =
"href": "sc://example.net/%23",
"pathname": "/%23"
}
},
{
"comment": "File URLs and (back)slashes",

This comment has been minimized.

Copy link
@joyeecheung

joyeecheung Apr 8, 2017

Member

Can you update the hash of the link in the comment at the top of this file

/* WPT Refs:
   https://github.com/w3c/web-platform-tests/blob/e48dd15/url/setters_tests.json
   License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
*/

This should be 3eff1bd now.

This comment has been minimized.

Copy link
@watilde

watilde Apr 8, 2017

Author Member

updated it to 3eff1bd

@@ -5110,6 +5110,246 @@ module.exports =
"search": "?test",
"hash": "#x"
},
"# File URLs and many (back)slashes",

This comment has been minimized.

Copy link
@watilde

watilde Apr 8, 2017

Author Member

Done synchronising them all by hands, and the lines were added as a result! thanks.

@watilde watilde force-pushed the watilde:feature/file-slash-2 branch 2 times, most recently Apr 8, 2017

url: trim leading slashes of file URL paths
It should trim the slashes after the colon into three for file URL.

Refs: web-platform-tests/wpt#5195
Fixes: #11188

@watilde watilde force-pushed the watilde:feature/file-slash-2 branch to 5d0f60d Apr 8, 2017

@watilde

This comment has been minimized.

Copy link
Member Author

commented Apr 8, 2017

@watilde

This comment has been minimized.

Copy link
Member Author

commented Apr 9, 2017

The windows-fanned failure looks unrelated.

@refack

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

The windows-fanned failure looks unrelated.

Yep failed test on windows because of #12283, CI can be considered green.

@refack

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

Another one for good luck
CI: https://ci.nodejs.org/job/node-test-pull-request/7295/

@watilde

This comment has been minimized.

Copy link
Member Author

commented Apr 10, 2017

@refack Thanks for following up! I'm going to merge this tonight :)

@watilde

This comment has been minimized.

Copy link
Member Author

commented Apr 10, 2017

Landed in b470a85. Thanks!

@watilde watilde closed this Apr 10, 2017

@watilde watilde deleted the watilde:feature/file-slash-2 branch Apr 10, 2017

watilde added a commit that referenced this pull request Apr 10, 2017
url: trim leading slashes of file URL paths
It should trim the slashes after the colon into three for file URL.

PR-URL: #12203
Refs: web-platform-tests/wpt#5195
Fixes: #11188
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@italoacasas

This comment has been minimized.

Copy link
Member

commented Apr 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
7 participants
You can’t perform that action at this time.