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

repeat any query params after a fragment #1341

Merged

Conversation

colmben
Copy link
Contributor

@colmben colmben commented Sep 21, 2019

Url.generate was modified in 2015 to put any query params before any fragment element of the url, based on pull #214 which suggested that the URI RFC says fragment should be at the end and referencing a possible issue with an iOS app not being able to read query params after the fragment. In fact the RFC specifically says "The characters slash ("/") and question mark ("?") are allowed to represent data within the fragment identifier." - https://tools.ietf.org/html/rfc3986#section-3.5 .

Putting the query params before the hash fragment breaks the reset password flow for Angular apps using HashLocationStrategy, i.e. the redirect to the Angular reset password component will have a hash fragment in it (see #599 ). At this stage, 4 years later, I can imagine the maintainers of this lib will be wary of reverting to putting the params after the fragment. At the same time it feels like overkill to introduce a config element just for this (and the complexity of doing that is probably why we have no PR 3 years after the Angular issue was first raised). So what I am proposing is simply a belt and braces approach - put the query params both before and after the fragment. I have confirmed this fixes the reset password flow for Angular when using HashLocationStrategy and https://github.com/neroniaky/angular-token. I have also confirmed that this doesn't break the currently working flow for Angular apps using the default PathLocationStrategy. I've also checked the resulting rediect url with the repeated params for validity against various URL parsers and it passes.

What do you think?

Copy link
Collaborator

@MaicolBen MaicolBen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@MaicolBen MaicolBen merged commit a93aca6 into lynndylanhurley:master Oct 12, 2019
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.

2 participants