history-browser icon indicating copy to clipboard operation
history-browser copied to clipboard

Consecutive Slashes in URL

Open jeansimoncollard opened this issue 5 years ago • 2 comments

I'm submitting a bug report

  • Library Version: 1.3.0

Please tell us about your environment:

  • Operating System: Windows 10

  • NPM Version: 6.4.1

  • Browser: At least Chrome 73.0.3683.75 and Internet Explorer

  • Language: TypeScript

Current behavior:

When the URL has double slashes (example: http://localhost:9000//route?parm1=... or http://localhost:9000/route1//route2?parm1=...), history.replaceState will remove the double slashes. This will produce the following security error because the two URLs don't match anymore:

Unhandled rejection SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL [...] cannot be created in a document with origin 'http://localhost:9000' and URL [...].

Steps to reproduce Add an extra slash to have two consecutive slashes inside any route of your Aurelia app

Expected behavior

Url should be insensitive to the number of consecutive slashes

Use Case

We have an external partner with a very long release cycle who is calling us with two consecutive slashes

jeansimoncollard avatar Mar 19 '19 20:03 jeansimoncollard

@jeansimoncollard If you'd be willing to create a PR to normalize the URLs before we call the history APIs internally, we'd be happy to accept that.

EisenbergEffect avatar Mar 19 '19 23:03 EisenbergEffect

I've already discussed with op, he needs a little guidance and he's willing to try his hand at a pr.

On Tue, Mar 19, 2019, 19:39 Rob Eisenberg [email protected] wrote:

@jeansimoncollard https://github.com/jeansimoncollard If you'd be willing to create a PR to normalize the URLs before we call the history APIs internally, we'd be happy to accept that.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aurelia/history-browser/issues/48#issuecomment-474626265, or mute the thread https://github.com/notifications/unsubscribe-auth/ADquv3vY6yydZ7yB_vJg_cW10cybvSnYks5vYXUVgaJpZM4b9AcP .

davismj avatar Mar 20 '19 01:03 davismj