Skip to content

Commit

Permalink
Fix for form names containing "=": split first then unescape components
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
  • Loading branch information
tlrobinson authored and leahneukirchen committed May 23, 2009
1 parent 480eb78 commit f61f21c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/utils.rb
Expand Up @@ -37,7 +37,7 @@ def parse_query(qs, d = nil)
params = {}

(qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
k, v = unescape(p).split('=', 2)
k, v = p.split('=', 2).map { |x| unescape(x) }

if cur = params[k]
if cur.class == Array
Expand Down
1 change: 1 addition & 0 deletions test/spec_rack_utils.rb
Expand Up @@ -28,6 +28,7 @@
should.equal "foo" => "1", "bar" => "2"
Rack::Utils.parse_query("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F").
should.equal "my weird field" => "q1!2\"'w$5&7/z8)?"
Rack::Utils.parse_query("foo%3Dbaz=bar").should.equal "foo=baz" => "bar"
end

specify "should parse nested query strings correctly" do
Expand Down

0 comments on commit f61f21c

Please sign in to comment.