Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
rubygem-actionpack-2_3
2-3-null_param.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2-3-null_param.patch of Package rubygem-actionpack-2_3
Index: lib/action_controller/request.rb =================================================================== --- lib/action_controller/request.rb.orig 2012-07-17 18:40:44.473685229 +0200 +++ lib/action_controller/request.rb 2012-07-18 15:56:37.275926093 +0200 @@ -491,5 +491,26 @@ EOM value end end + protected + + # Remove nils from the params hash + def deep_munge(hash) + hash.each_value do |v| + case v + when Array + v.grep(Hash) { |x| deep_munge(x) } + when Hash + deep_munge(v) + end + end + + keys = hash.keys.find_all { |k| hash[k] == [nil] } + keys.each { |k| hash[k] = nil } + hash + end + + def parse_query(qs) + deep_munge(super) + end end end Index: test/controller/request/query_string_parsing_test.rb =================================================================== --- test/controller/request/query_string_parsing_test.rb.orig 2012-07-17 18:40:44.537685229 +0200 +++ test/controller/request/query_string_parsing_test.rb 2012-07-18 15:56:04.470818058 +0200 @@ -81,7 +81,12 @@ class QueryStringParsingTest < ActionCon end test "query string without equal" do - assert_parses({ "action" => nil }, "action") + assert_parses({"action" => nil}, "action") + assert_parses({"action" => {"foo" => nil}}, "action[foo]") + assert_parses({"action" => {"foo" => { "bar" => nil }}}, "action[foo][bar]") + assert_parses({"action" => {"foo" => { "bar" => nil }}}, "action[foo][bar][]") + assert_parses({"action" => {"foo" => nil}}, "action[foo][]") + assert_parses({"action"=>{"foo"=>[{"bar"=>nil}]}}, "action[foo][][bar]") end test "query string with empty key" do
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor