-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add support for custom protocols with the allowCustomProtocols
option
#132
Conversation
What kind of compatibility would it break? I would like to make it on by default. Just trying to think about the repercussions. |
Thinking out loud, do we even need an option for this? It kinda feels like a bug-fix. The existing behavior is clearly incorrect. It's correctly handled by new URL('custom+with+plusses://sindresorhus.com')
//=> URL {origin: "null", protocol: "custom+with+plusses:", username: "", password: "", host: "", …} |
You're right, there probably aren't any compatibility changes, I'm always just a bit cautious when I'm adding a new use case and I'm not the author, so there may be things I've missed. I'll make this the default behavior then 👍 Do you want to keep the error on the |
There's one possible ambiguity here. See: sindresorhus/prepend-http#4 Not sure how to handle that. Either disallow auth or require the custom protocol to use |
I don't think this library handles auth in the url does it? Or at least currently it strips it out. eg:
This PR shouldn't affect that, since like you say, it uses Edit: According to the spec, the delimiter between protocol (scheme) and other things should be |
You're right. Then that's a non-issue.
Not sure what you're asking, but we should preserve it if it's there. We cannot normalize it away as it changes the semantics. |
I think we could remove it. |
Bump :) |
Closing for lack of response. Happy to reopen if you ever get to this. |
We have been having problems with app protocols like "my.app://path/to/something".
A quick looks shows that valid protocols can have periods, hyphens and pluses in them and remain valid.
This PR keeps existing behavior unless the
allowCustomProtocols
option is provided, in which case more complex protocols aren't mangled.Changes at a glance
Before:
After:
As you can see the before example doesn't make much sense. I feel like this would probably be a sane default to have enabled, but I don't want to break compatibility, so I'll leave that up to you.