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

parse_query_parameters behaves differently than Rack::Utils#parse_nested_query #92

Closed
nladd opened this issue Jul 7, 2014 · 3 comments
Milestone

Comments

@nladd
Copy link

nladd commented Jul 7, 2014

The parse_query_parameters method exhibits behavior different from Rack::Utils#parse_nested_query when receiving a query string containing duplicate keys. Given a params string like "foo=bar&foo=baz", Rack::Utils#parse_nested_query will return the last instance of foo resulting in {"foo" => "baz"}. Given the same parameter string, parse_query_parameters returns the first instance of foo resulting in {"foo" => "bar"}. This difference in behavior causes the Rails check_box form helper to always submit a zero value because of the hidden input rails inserts box the checkbox input.

@mpalmer
Copy link
Contributor

mpalmer commented Jun 23, 2015

I'm inclined just to gut the vast majority of the code in NestedParams and pass the request body off to Rack::Utils.parse_nested_query. Anyone disagree? It'll be a behaviour change, though, so it won't be a candidate for an actual fix until 2.0.

@jjb
Copy link
Contributor

jjb commented Jun 23, 2015

Sounds fine to me. Looks like it has a decent set of tests, so we could swap out the guts with confidence. @nladd, could you write us a failing test which illustrates the problem?

@mpalmer mpalmer added this to the 2.0 milestone Jul 31, 2015
@mpalmer
Copy link
Contributor

mpalmer commented Oct 27, 2017

This is getting fixed as part of #137.

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

3 participants