diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 202da1d3b846f20551c29e21cce71e4100e44253..fe0700444db21b08f7ee2188c1775a6d508d0c21 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -125,7 +125,7 @@ * Add assertions with friendly messages to TestCase#process to ensure that @controller, @request, and @response are set. #1367 -* Arrays sent via multipart posts are converted to strings #1032 [dj@omelia.org] +* Arrays, hashes sent via multipart posts are converted to strings #1032 [dj@omelia.org, me@julik.nl] * render(:layout => true) is a synonym for render(:layout => nil) diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb index dc1b1189b557da35f952fac67ba2140d28c312fa..81bc4867decfe7e4c40f68c5371000edbd3e42ec 100755 --- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb +++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb @@ -70,7 +70,7 @@ def CGIMethods.get_typed_value(value) # Value as part of a multipart request value.read elsif value.class == Array - value.collect { | e | e.respond_to?(:read) ? e.read : e } + value.collect { |v| CGIMethods.get_typed_value(v) } else # Standard value (not a multipart request) value.to_s diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index 1749eb0c80dbd259eab421159e7a2d761bbada04..1e4bb16337859f3a11ffd08fc45402374c3fa3cb 100755 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -1,3 +1,4 @@ +$:.unshift File.dirname(__FILE__) + "/../../lib" require 'test/unit' require 'action_controller/cgi_ext/cgi_methods' @@ -112,6 +113,7 @@ def test_parse_params_from_multipart_upload "something" => [ StringIO.new("") ], "array_of_stringios" => [[ StringIO.new("One"), StringIO.new("Two") ]], "mixed_types_array" => [[ StringIO.new("Three"), "NotStringIO" ]], + "mixed_types_as_checkboxes[strings][nested]" => [[ mock_file, "String", StringIO.new("StringIO")]], "products[string]" => [ StringIO.new("Apple Computer") ], "products[file]" => [ mock_file ] } @@ -120,6 +122,11 @@ def test_parse_params_from_multipart_upload "something" => "", "array_of_stringios" => ["One", "Two"], "mixed_types_array" => [ "Three", "NotStringIO" ], + "mixed_types_as_checkboxes" => { + "strings"=> { + "nested"=>[ mock_file, "String", "StringIO" ] + }, + }, "products" => { "string" => "Apple Computer", "file" => mock_file