Permalink
Browse files

Fixed that ActionController::Base#read_multipart would fail if bounda…

…ry was exactly 10240 bytes (closes #10886) [ariejan]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9113 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Mar 28, 2008
1 parent 4aca503 commit 388e5d3fac146ee10b636aca195620c562cdb522
Showing with 22 additions and 2 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +0 −1 actionpack/lib/action_controller/request.rb
  3. +20 −1 actionpack/test/controller/request_test.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that ActionController::Base#read_multipart would fail if boundary was exactly 10240 bytes #10886 [ariejan]
+
* Fixed HTML::Tokenizer (used in sanitize helper) didn't handle unclosed CDATA tags #10071 [esad, packagethief]
* Improve documentation. [Radar, Jan De Poorter, chuyeow, xaviershay, danger, miloops, Xavier Noria, Sunny Ripert]
@@ -585,7 +585,6 @@ def read_multipart(body, boundary, content_length, env)
else
params[name] = [content]
end
- break if buf.size == 0
break if content_length == -1
end
raise EOFError, "bad boundary end of body part" unless boundary_end=~/--/
@@ -601,7 +601,7 @@ def test_parse_params_from_multipart_upload
"ie_products[string]" => [ UploadedStringIO.new("Microsoft") ],
"ie_products[file]" => [ ie_file ],
"text_part" => [non_file_text_part]
- }
+ }
expected_output = {
"something" => "",
@@ -744,6 +744,25 @@ def test_text_file
assert_equal 'contents', file.read
end
+ def test_boundary_problem_file
+ params = process('boundary_problem_file')
+ assert_equal %w(file foo), params.keys.sort
+
+ file = params['file']
+ foo = params['foo']
+
+ if RUBY_VERSION > '1.9'
+ assert_kind_of File, file
+ else
+ assert_kind_of Tempfile, file
+ end
+
+ assert_equal 'file.txt', file.original_filename
+ assert_equal "text/plain", file.content_type
+
+ assert_equal 'bar', foo
+ end
+
def test_large_text_file
params = process('large_text_file')
assert_equal %w(file foo), params.keys.sort

0 comments on commit 388e5d3

Please sign in to comment.