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.format ignores the "slashes" prop #48

Open
wvanvugt-speedline opened this issue Dec 12, 2019 · 2 comments
Open

url.format ignores the "slashes" prop #48

wvanvugt-speedline opened this issue Dec 12, 2019 · 2 comments

Comments

@wvanvugt-speedline
Copy link

wvanvugt-speedline commented Dec 12, 2019

URL.format includes the leading slashes regardless of what the slashes property is set to. The behavior is not present in node's URL package.

const nodeUrl = require("url");
const npmUrl = require("./node_modules/url");
console.log(nodeUrl.format({ hostname: "example.com", slashes: false }));
// => example.com (good)
console.log(npmUrl.format({ hostname: "example.com", slashes: false }));
// => //example.com (bad)
console.log(nodeUrl.format({ hostname: "example.com", slashes: true }));
// => //example.com
console.log(npmUrl.format({ hostname: "example.com", slashes: true }));
// => //example.com

I am using:
NodeJS 10.16.0
url package 0.11.0

@ljharb
Copy link
Collaborator

ljharb commented Jan 27, 2021

Thanks, this definitely seems like a bug (altho it's also possible that these examples do the same thing in an older version of node).

Once tests on this repo are sorted out, a PR with a failing test case (with or without a fix) would be appreciated.

@ljharb
Copy link
Collaborator

ljharb commented Jan 28, 2021

See #53 as well; this will be addressed as part of "node catchup".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants