Permalink
Browse files

rack 1.6 encodes the filenames in posts correctly now

  • Loading branch information...
1 parent 3ef98a1 commit 8e105a55383a3c94dfe3507c37b79a5e4fe85276 @tenderlove tenderlove committed Jul 15, 2014
Showing with 1 addition and 8 deletions.
  1. +1 −8 actionpack/lib/action_dispatch/http/upload.rb
@@ -27,7 +27,7 @@ def initialize(hash) # :nodoc:
@tempfile = hash[:tempfile]
raise(ArgumentError, ':tempfile is required') unless @tempfile
- @original_filename = encode_filename(hash[:filename])
+ @original_filename = hash[:filename]
@content_type = hash[:type]
@headers = hash[:head]
end
@@ -66,13 +66,6 @@ def size
def eof?
@tempfile.eof?
end
-
- private
-
- def encode_filename(filename)
- # Encode the filename in the utf8 encoding, unless it is nil
- filename.force_encoding(Encoding::UTF_8).encode! if filename
- end
end
end
end

2 comments on commit 8e105a5

Owner

rafaelfranca replied Jul 16, 2014

This is not true on Ruby 1.9 😢

Owner

rafaelfranca replied Jul 16, 2014

  1) Failure:
ActionDispatch::UploadedFileTest#test_filename_should_be_in_utf_8 [/Users/rafaelfranca/src/rails/rails/actionpack/test/dispatch/uploaded_file_test.rb:18]:
Expected: "UTF-8"
  Actual: "US-ASCII"
Please sign in to comment.