Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 2375

Show
Ignore:
Timestamp:
09/27/05 22:23:37 (3 years ago)
Author:
bitsweat
Message:

Ticket #2295 - Tolerate consecutive delimiters in query parameters

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r2368 r2375  
    11*SVN* 
     2 
     3* Tolerate consecutive delimiters in query parameters.  #2295 [darashi@gmail.com] 
    24 
    35* Streamline render process, code cleaning. Closes #2294. [skae] 
  • trunk/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb

    r2345 r2375  
    1212   
    1313      query_string.split(/[&;]/).each { |p|  
     14        # Ignore repeated delimiters. 
     15        next if p.empty? 
     16 
    1417        k, v = p.split('=',2) 
    1518        v = nil if (v && v.empty?) 
  • trunk/actionpack/test/controller/cgi_test.rb

    r2345 r2375  
    1515    @query_string_with_many_equal = "action=create_customer&full_name=abc=def=ghi" 
    1616    @query_string_without_equal = "action" 
     17    @query_string_with_many_ampersands = 
     18      "&action=create_customer&&&full_name=David%20Heinemeier%20Hansson" 
    1719  end 
    1820 
     
    6769    )     
    6870  end 
    69    
     71 
     72  def test_query_string_with_many_ampersands 
     73    assert_equal( 
     74      { "action" => "create_customer", "full_name" => "David Heinemeier Hansson"}, 
     75      CGIMethods.parse_query_parameters(@query_string_with_many_ampersands) 
     76    ) 
     77  end 
     78 
    7079  def test_parse_params 
    7180    input = {