Skip to content

Commit

Permalink
rack 1.6 encodes the filenames in posts correctly now
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jul 15, 2014
1 parent 3ef98a1 commit 8e105a5
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions actionpack/lib/action_dispatch/http/upload.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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

@rafaelfranca
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true on Ruby 1.9 😢

@rafaelfranca
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  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.