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

URLs with redundant slashes cause Unpoly to trigger a DOMException #612

Open
makmic opened this issue May 8, 2024 · 1 comment
Open

Comments

@makmic
Copy link

makmic commented May 8, 2024

Bug description

While testing an application which was using Unpoly, I noticed that the Cookie Banner was somehow not working at all.
The culprit however was the JavaScript exception within Unpoly's source code:

Uncaught DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL 'http://en/sign-in' cannot be created in a document with origin 'http://foobar.lvh.me:3000' and URL 'http://foobar.lvh.me:3000//en/sign-in'.

Due to a copy&paste mistake I was accessing the page at http://foobar.lvh.me:3000//en/sign-in' (two forward slashes) instead of http://foobar.lvh.me:3000/en/sign-in'. That's a niche case, but as the application renders fine in this case I'd except Unpoly not to crash too.

Steps to reproduce the behavior:

  1. Go to https://unpoly.com//install
  2. See the following error in the console:
Uncaught DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL 'https://install/' cannot be created in a document with origin 'https://unpoly.com' and URL 'https://unpoly.com//install'.

Browser version

  • OS: Linux
  • Browser Chrome
  • Version 124
@adam12
Copy link
Member

adam12 commented May 8, 2024

Thanks for the report. I see the same on Safari + MacOS.

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