Permalink
Browse files

Tolerate missing content type on multipart file uploads. Fix for Safa…

…ri 3.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7005 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent e4e275d commit 979c22444d832e51b29c0404e3b990cab00606e9 @jeremy jeremy committed Jun 12, 2007
@@ -1,5 +1,7 @@
*SVN*
+* Tolerate missing content type on multipart file uploads. Fix for Safari 3. [Jeremy Kemper]
+
* Deprecation: remove pagination. Install the classic_pagination plugin for forward compatibility, or move to the superior will_paginate plugin. #8157 [Josh Peek]
* Action caching is limited to GET requests returning 200 OK status. #3335 [tom@craz8.com, halfbyte, Dan Kubb, Josh Peek]
@@ -423,10 +423,8 @@ def get_typed_value(value)
when Array
value.map { |v| get_typed_value(v) }
else
- # Uploaded file provides content type and filename.
- if value.respond_to?(:content_type) &&
- !value.content_type.blank? &&
- !value.original_filename.blank?
+ # This is an uploaded file.
+ if value.respond_to?(:original_filename) && !value.original_filename.blank?
unless value.respond_to?(:full_original_filename)
class << value
alias_method :full_original_filename, :original_filename
@@ -690,8 +690,8 @@ def test_binary_file
file = params['file']
assert_kind_of StringIO, file
- assert_equal 'file.txt', file.original_filename
- assert_equal "text/plain\r", file.content_type
+ assert_equal 'file.csv', file.original_filename
+ assert_equal '', file.content_type
assert_equal 'contents', file.read
file = params['flowers']
Binary file not shown.

0 comments on commit 979c224

Please sign in to comment.