Changeset 5904
- Timestamp:
- 01/12/07 09:10:58 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb (modified) (1 diff)
- trunk/actionpack/test/controller/cgi_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r5896 r5904 1 1 *SVN* 2 3 * Fix parsing of array[] CGI parameters so extra empty values aren't included. #6252 [Nicholas Seckar, aiwilliams, brentrowland] 2 4 3 5 * link_to_unless_current works with full URLs as well as paths. #6891 [Jarkko Laine, manfred, idrifter] trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
r5473 r5904 24 24 parser = FormEncodedPairParser.new 25 25 26 finished = false 27 until finished 28 finished = true 26 params = params.dup 27 until params.empty? 29 28 for key, value in params 30 next if key.blank? 31 if !key.include?('[') 29 if key.blank? 30 params.delete key 31 elsif !key.include?('[') 32 32 # much faster to test for the most common case first (GET) 33 33 # and avoid the call to build_deep_hash 34 34 parser.result[key] = get_typed_value(value[0]) 35 params.delete key 35 36 elsif value.is_a?(Array) 36 37 parser.parse(key, get_typed_value(value.shift)) 37 finished = false unlessvalue.empty?38 params.delete key if value.empty? 38 39 else 39 40 raise TypeError, "Expected array, found #{value.inspect}" trunk/actionpack/test/controller/cgi_test.rb
r5473 r5904 426 426 assert_equal ["yes"], alt_cookies["is_admin"] 427 427 end 428 429 def test_unbalanced_query_string_with_array 430 assert_equal( 431 {'location' => ["1", "2"], 'age_group' => ["2"]}, 432 CGIMethods.parse_query_parameters("location[]=1&location[]=2&age_group[]=2") 433 ) 434 assert_equal( 435 {'location' => ["1", "2"], 'age_group' => ["2"]}, 436 CGIMethods.parse_request_parameters({'location[]' => ["1", "2"], 437 'age_group[]' => ["2"]}) 438 ) 439 end 428 440 end