aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/cgi_ext/cgi_methods.rb2
-rwxr-xr-xactionpack/test/controller/cgi_test.rb6
3 files changed, 6 insertions, 4 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index aefa0678b4..a4f7e2aa93 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Change the query parser to map empty GET params to "" rather than nil. Closes #5694. [Nicholas Seckar]
+
* date_select and datetime_select take a :default option. #7052 [nik.wakelin]
date_select "post", "written_on", :default => 3.days.from_now
date_select "credit_card", "bill_due", :default => { :day => 20 }
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
index 55bece29d1..b06966729a 100755
--- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
+++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
@@ -12,7 +12,7 @@ class CGIMethods #:nodoc:
next if chunk.empty?
key, value = chunk.split('=', 2)
next if key.empty?
- value = (value.nil? || value.empty?) ? nil : CGI.unescape(value)
+ value = value.nil? ? nil : CGI.unescape(value)
[ CGI.unescape(key), value ]
end.compact
diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb
index e7d44802a5..d5c8ee0063 100755
--- a/actionpack/test/controller/cgi_test.rb
+++ b/actionpack/test/controller/cgi_test.rb
@@ -8,7 +8,7 @@ require 'stringio'
class CGITest < Test::Unit::TestCase
def setup
@query_string = "action=create_customer&full_name=David%20Heinemeier%20Hansson&customerId=1"
- @query_string_with_nil = "action=create_customer&full_name="
+ @query_string_with_empty = "action=create_customer&full_name="
@query_string_with_array = "action=create_customer&selected[]=1&selected[]=2&selected[]=3"
@query_string_with_amps = "action=create_customer&name=Don%27t+%26+Does"
@query_string_with_multiple_of_same_name =
@@ -68,8 +68,8 @@ class CGITest < Test::Unit::TestCase
def test_query_string_with_nil
assert_equal(
- { "action" => "create_customer", "full_name" => nil},
- CGIMethods.parse_query_parameters(@query_string_with_nil)
+ { "action" => "create_customer", "full_name" => ''},
+ CGIMethods.parse_query_parameters(@query_string_with_empty)
)
end