Fixed that file.content_type for uploaded files would include a trailing \r #9053 [bgreenlee]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7212 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
80150a0cfb
commit
937a7abe45
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Fixed that file.content_type for uploaded files would include a trailing \r #9053 [bgreenlee]
|
||||||
|
|
||||||
* url_for now accepts a series of symbols representing the namespace of the record [Josh Knowles]
|
* url_for now accepts a series of symbols representing the namespace of the record [Josh Knowles]
|
||||||
|
|
||||||
* Make :trailing_slash work with query parameters for url_for. Closes #4004 [nov]
|
* Make :trailing_slash work with query parameters for url_for. Closes #4004 [nov]
|
||||||
|
|
|
@ -542,7 +542,7 @@ module ActionController
|
||||||
filename = CGI.unescape(filename)
|
filename = CGI.unescape(filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
/Content-Type: (.*)/ni.match(head)
|
/Content-Type: ([^\r]*)/ni.match(head)
|
||||||
content_type = ($1 or "")
|
content_type = ($1 or "")
|
||||||
|
|
||||||
(class << content; self; end).class_eval do
|
(class << content; self; end).class_eval do
|
||||||
|
|
|
@ -667,7 +667,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
||||||
file = params['file']
|
file = params['file']
|
||||||
assert_kind_of StringIO, file
|
assert_kind_of StringIO, file
|
||||||
assert_equal 'file.txt', file.original_filename
|
assert_equal 'file.txt', file.original_filename
|
||||||
assert_equal "text/plain\r", file.content_type
|
assert_equal "text/plain", file.content_type
|
||||||
assert_equal 'contents', file.read
|
assert_equal 'contents', file.read
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
||||||
file = params['file']
|
file = params['file']
|
||||||
assert_kind_of Tempfile, file
|
assert_kind_of Tempfile, file
|
||||||
assert_equal 'file.txt', file.original_filename
|
assert_equal 'file.txt', file.original_filename
|
||||||
assert_equal "text/plain\r", file.content_type
|
assert_equal "text/plain", file.content_type
|
||||||
assert ('a' * 20480) == file.read
|
assert ('a' * 20480) == file.read
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase
|
||||||
file = params['flowers']
|
file = params['flowers']
|
||||||
assert_kind_of StringIO, file
|
assert_kind_of StringIO, file
|
||||||
assert_equal 'flowers.jpg', file.original_filename
|
assert_equal 'flowers.jpg', file.original_filename
|
||||||
assert_equal "image/jpeg\r", file.content_type
|
assert_equal "image/jpeg", file.content_type
|
||||||
assert_equal 19512, file.size
|
assert_equal 19512, file.size
|
||||||
#assert_equal File.read(File.dirname(__FILE__) + '/../../../activerecord/test/fixtures/flowers.jpg'), file.read
|
#assert_equal File.read(File.dirname(__FILE__) + '/../../../activerecord/test/fixtures/flowers.jpg'), file.read
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue