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

use regex to capture cabal key instead of URL #89

Merged
merged 1 commit into from
May 22, 2020

Conversation

cblgh
Copy link
Member

@cblgh cblgh commented May 22, 2020

apparently the new URL() behaviour is unpredictable. chrome, node, and
firefox all return different values when a cabal key is passed in.
(searchParams always seems to work, however)

for node the cabal key can be found in uri.host, in chromium/electron
it's found at uri.hostname, for firefox both of those are empty, but
uri.pathname gives the cabal key prepended with two slashes (but that
doesn't work in node...)

until the IANA change lands / has a standardizing effect, let's just use
a regex to capture it.

this patch also changes isHypercoreKey to use the same regex as cabal-client.
i dunno if hypercore has a strict lower-case character requirement, however

fixes #88

apparently the new URL() behaviour is unpredictable. chrome, node, and
firefox all return different values when a cabal key is passed in.

for node the cabal key can be found in `uri.host`, in chromium/electron
it's found at `uri.hostname`, for firefox both of those are empty, but
`uri.pathname` gives the cabal key prepended with two slashes (but that
doesn't work in node...)

until the IANA change lands / has a standardizing effect, let's just use
a regex to capture it.

fixes #88
@cblgh cblgh merged commit 0af3789 into master May 22, 2020
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

Successfully merging this pull request may close these issues.

host from URL is undefined in electron/browsers
1 participant