Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: avoid URL-confusing default pathname in baseUrl #565

Merged
merged 1 commit into from
Feb 15, 2021

Conversation

platosha
Copy link
Contributor

Fixes #517

When not set explicitly, the router constructor discovers baseUrl
using the <base href> value and initial document URL. However, only
the pathname from the discovered base URL was taken for the default
value of the baseUrl property. In case of initial pathname starting with
double slash //, such a value was then throwing Invalid URL error when
used as the URL constructor’s first argument.

This changes the default value discovery of baseUrl, so that it uses
an actual URL instead of only pathname to avoid throwing errors.

Fixes #517

When not set explicitly, the router constructor discovers `baseUrl`
using the `<base href>` value and initial document URL. However, only
the pathname from the discovered base URL was taken for the default
value of the `baseUrl` property. In case of initial pathname starting with
double slash `//`, such a value was then throwing `Invalid URL` error when
used as the URL constructor’s first argument.

This changes the default value discovery of `baseUrl`, so that it uses
an actual URL instead of only pathname to avoid throwing errors.
@platosha platosha added the hilla label Feb 12, 2021
@platosha platosha merged commit a550589 into master Feb 15, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uncaught JS exception when malformed URL is supplied
2 participants