summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortlrobinson <tom@280north.com>2009-05-22 15:46:01 -0700
committerChristian Neukirchen <chneukirchen@gmail.com>2009-05-23 14:30:19 +0200
commitf61f21c22caf2d784d2a0e00e4866cf528c21ced (patch)
tree12aeaf6e65fa3ad4a88c39c16cd31a44b133e050
parent480eb783477175d5c409d38258a65ce6cf3175e4 (diff)
downloadrack-f61f21c22caf2d784d2a0e00e4866cf528c21ced.tar.gz
Fix for form names containing "=": split first then unescape components
Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
-rw-r--r--lib/rack/utils.rb2
-rw-r--r--test/spec_rack_utils.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/rack/utils.rb b/lib/rack/utils.rb
index 40f9b492..2d1ddc59 100644
--- a/lib/rack/utils.rb
+++ b/lib/rack/utils.rb
@@ -37,7 +37,7 @@ module Rack
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
diff --git a/test/spec_rack_utils.rb b/test/spec_rack_utils.rb
index 8f4fd758..7dd5880e 100644
--- a/test/spec_rack_utils.rb
+++ b/test/spec_rack_utils.rb
@@ -28,6 +28,7 @@ context "Rack::Utils" do
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