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] fixes validatePath duplicate params & reject spaces in routes #420

Merged
merged 5 commits into from
Apr 16, 2020

Conversation

olance
Copy link
Contributor

@olance olance commented Apr 11, 2020

Closes #382

This PR makes validatePath throw an error when a route's provided path contains at least one space character.
It's only looking for ' '; I figured other whitespace characters such as '\t', '\n', ... would make so little sense that it does not warrant "complicating" the code & tests with that.

Super easy to change if you'd rather reject everything though!

I also took the opportunity to fix the duplicate params detection, which was broken when only one of two duplicates used a type, and to refactor the router's utils tests a little 🙂

Question: I intentionally added a test case that validates '/users/{id}/photos/{photo_id}?format=jpg&w=400&h=400' as a valid route.
I don't see why not, but I wanted to make sure we actually allow query strings in routes paths?

@olance olance changed the title Router/validate path [Router] fixes validatePath duplicate params & reject spaces in routes Apr 11, 2020
@olance
Copy link
Contributor Author

olance commented Apr 11, 2020

@thedavidprice not sure why checks are run twice?

@thedavidprice
Copy link
Contributor

thedavidprice commented Apr 11, 2020 via email

@thedavidprice
Copy link
Contributor

FYI: we’ve added a CI runner for Windows and changed PR settings to require checks to pass before merging. Pulling in changes from master should resolve current warnings.

@olance
Copy link
Contributor Author

olance commented Apr 15, 2020

@thedavidprice @peterp this is ready to be reviewed 🙂

@peterp peterp merged commit f93c583 into redwoodjs:master Apr 16, 2020
@peterp peterp added this to the next-release milestone Apr 16, 2020
@olance olance deleted the router/validatePath branch April 17, 2020 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Router] Routes allow spaces but fail on them
3 participants