Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix for form names containing "=": split first then unescape components

  • Loading branch information...
commit 03a2e8bfa5d1e5ac388775d13f61a0e430c46e43 1 parent 0bc5662
authored May 22, 2009
2  lib/rack/utils.rb
@@ -37,7 +37,7 @@ def parse_query(qs, d = nil)
37 37
       params = {}
38 38
 
39 39
       (qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
40  
-        k, v = unescape(p).split('=', 2)
  40
+        k, v = p.split('=', 2).map { |x| unescape(x) }
41 41
 
42 42
         if cur = params[k]
43 43
           if cur.class == Array
1  test/spec_rack_utils.rb
@@ -28,6 +28,7 @@
28 28
       should.equal "foo" => "1", "bar" => "2"
29 29
     Rack::Utils.parse_query("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F").
30 30
       should.equal "my weird field" => "q1!2\"'w$5&7/z8)?"
  31
+    Rack::Utils.parse_query("foo%3Dbaz=bar").should.equal "foo=baz" => "bar"
31 32
   end
32 33
 
33 34
   specify "should parse nested query strings correctly" do

0 notes on commit 03a2e8b

Please sign in to comment.
Something went wrong with that request. Please try again.