Decode extra parameters when processing route#26
Open
voikya wants to merge 1 commit intopatriciomacadden:masterfrom
Open
Decode extra parameters when processing route#26voikya wants to merge 1 commit intopatriciomacadden:masterfrom
voikya wants to merge 1 commit intopatriciomacadden:masterfrom
Conversation
Updates `Hobbit::Base#find_route` to perform URI-decoding on any dynamic URI components before storing them in `request.params`. This provides greater consistency with both Rack's existing query params parsing and with other server libraries like Sinatra (which similarly decode dynamic URI components).
Contributor
Author
|
Regarding the failing CI tests, I opened up a separate pull request to fix them: #27 caused by broken development dependencies in the gemspec file. If you prefer, I can rebase this pull request over those changes if/when you merge them. |
Contributor
Author
|
@patriciomacadden Are you still interested in maintaining this repo? Or would you just recommend us to fork and develop it further on our own? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates
Hobbit::Base#find_routeto perform URI-decoding on any dynamicURI components before storing them in
request.params. This providesgreater consistency with both Rack's existing query params parsing
and with other server libraries like Sinatra (which similarly decode
dynamic URI segments).
This ensures that everything in
request.params(both from Rack and from Hobbit) will be URI-decoded, rather than mixing decoded query params and encoded path captures.For comparison:
Rack (query param decoding): https://github.com/rack/rack/blob/8d2e02abba44ac7e9d0ed2a4af9beb6063a81296/lib/rack/utils.rb#L54
Sinatra (unescaping captures like this pull request):
https://github.com/sinatra/sinatra/blob/a9649b4f18a9059de3161906c9c6e95ec06fdef9/lib/sinatra/base.rb#L1053
I added a test and confirmed tests pass (although some of the other development dependencies, such as the Code Climate integration, seem to now be defunct)
Note that this might result in backwards-incompatibility if someone was dependent on the previous behavior. However, I believe this arrangement is more consistent.