-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Closed
Labels
semver-majorPRs that contain breaking changes and should be released in the next major version.PRs that contain breaking changes and should be released in the next major version.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.
Description
Quoting the doc :
protocol is treated the same with or without the trailing : (colon).
The protocols http, https, ftp, gopher, file will be postfixed with :// (colon-slash-slash).
All other protocols mailto, xmpp, aim, sftp, foo, etc will be postfixed with : (colon).
slashes set to true if the protocol requires :// (colon-slash-slash)
Only needs to be set for protocols not previously listed as requiring slashes, such as mongodb://localhost:8000/.
But a quick test (using nodejs V4.1) show the problem:
url = require("url");
uri = url.parse("/home/user");
uri.protocol = "file";
console.log(url.format(uri));
Output : file:/home/user. While the expected output is : file:///home/user
Setting uri.slashes = true
make it format the correct URL.
I think it's not worth it to modify the module itself as it's stable. However the doc should be updated to reflect this behaviour.
Should I submit a PR reflecting this?
Metadata
Metadata
Assignees
Labels
semver-majorPRs that contain breaking changes and should be released in the next major version.PRs that contain breaking changes and should be released in the next major version.urlIssues and PRs related to the legacy built-in url module.Issues and PRs related to the legacy built-in url module.