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

Fix key generation #103

Merged
merged 1 commit into from Oct 24, 2015
Merged

Fix key generation #103

merged 1 commit into from Oct 24, 2015

Conversation

artygus
Copy link
Contributor

@artygus artygus commented Dec 10, 2014

Query string keys must be escaped after the split bacause:

  • Query string could look like 'weird%3Dkey=whatever'
  • Rake util's unescape method forces utf-8 encoding on strings, which will cause the "invalid byte sequence in UTF-8" error for the most string methods called on badly encoded strings, e.g. Rack::Utils::unescape('%D0%BA=%D1').split('=')

@grosser
Copy link
Collaborator

grosser commented Oct 8, 2015

can you add a test for that ?

I'd prefer map { |s| unescape(s) } to be more normal / less fancy

@grosser
Copy link
Collaborator

grosser commented Oct 8, 2015

can it use something more standard like @request.params ?

@artygus
Copy link
Contributor Author

artygus commented Oct 23, 2015

@grosser I added tests and rebased the commit. I guess we can't use params because params are merged with POST, although we could use @request.GET, but in that case resulting hash may have other hashes inside, e.g. from query string like this /test?a[b]=c&a[d]=e, and before Ruby 1.9 hashes didn't preserve keys ordering, so something like recursive sorting must implemented

grosser added a commit that referenced this pull request Oct 24, 2015
@grosser grosser merged commit ba510b3 into rtomayko:master Oct 24, 2015
@grosser
Copy link
Collaborator

grosser commented Oct 24, 2015

thx for fixing this nasty bug :)

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.

None yet

2 participants