summary refs log tree commit
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:25:28 +0200
commit7a55c98a30deea7fe198958d7c2770b087aa94b9 (patch)
treed941f078e694dfd69f269ecbf429fe921f471c17
parent0bc566223c735d9efa3a1d0d925e8d7001760b85 (diff)
downloadrack-7a55c98a30deea7fe198958d7c2770b087aa94b9.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 2903273c..228488c1 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 cdf25c37..077ccc50 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