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

Router doesn't match URLs with query params #40

Open
calebfaruki opened this issue Dec 22, 2020 · 2 comments
Open

Router doesn't match URLs with query params #40

calebfaruki opened this issue Dec 22, 2020 · 2 comments

Comments

@calebfaruki
Copy link

calebfaruki commented Dec 22, 2020

This could be patched on mainframe codebase with regex that capture query params, but it's annoying because most browsers don't support positive lookaheads/lookbehinds. Haven't found a suitable hack for this yet.

Solution would be to drop query params from router before the match and pass to view after route match.

@calebfaruki
Copy link
Author

Regex attempted but result in various RegExp issues.

^\/projects\/([a-z0-9]+)\??.*$ // captures, but no id or params passed to view.
^\/projects\/([a-z0-9]+)[/]*(\?.+)*$ // invalid capture group.

Test cases

/projects // shouldn't match
/projects/ // shouldn't match
/projects/fdsafdsa // should match
/projects/fdsafdsa/ // should match
/projects/fdsafdsa/download // shouldn't match
/projects/fdsafdsa?phase_id=fdsafdsa // should match
/projects/069fdb4a44b84013bca0f0f59ae9a718?phase_id=7776ca11567e4b8093217bd110d20b79 // should match
/projects/fdsafdsa/?phase_id=fdsafdsa/ // should match
/projects/fdsafdsa?phase_id=fdsafdsa/ // should match

@malomalo
Copy link
Owner

I think this currently works with this as the route '/projects/:id', but manual regexes do match against the query string. I think we should remove that too... @bemky what do you think?

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