From 979c22444d832e51b29c0404e3b990cab00606e9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 12 Jun 2007 07:44:23 +0000 Subject: Tolerate missing content type on multipart file uploads. Fix for Safari 3. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7005 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_controller/request.rb | 6 ++---- actionpack/test/controller/request_test.rb | 4 ++-- actionpack/test/fixtures/multipart/binary_file | Bin 19846 -> 19820 bytes 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 1b73b7019b..3ae169883d 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -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] diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 2f0e86d2a2..5dbd4db9f5 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -423,10 +423,8 @@ module ActionController 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 diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index e14036fd2f..49c404244f 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -690,8 +690,8 @@ class MultipartRequestParameterParsingTest < Test::Unit::TestCase 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'] diff --git a/actionpack/test/fixtures/multipart/binary_file b/actionpack/test/fixtures/multipart/binary_file index 7e4c68c62e..556187ac1f 100644 Binary files a/actionpack/test/fixtures/multipart/binary_file and b/actionpack/test/fixtures/multipart/binary_file differ -- cgit v1.2.3