Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Rack gets a newline at the end of the content_type in certain instanc…
Browse files Browse the repository at this point in the history
…es: 'image/jpeg\r' which causes S3 to be unable to accept the file. Fixes #817
  • Loading branch information
nzifnab authored and mike-burns committed Sep 7, 2012
1 parent 45bf52a commit eb92834
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/paperclip/io_adapters/uploaded_file_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(target)

def cache_current_values
@original_filename = @target.original_filename
@content_type = @target.content_type
@content_type = @target.content_type.to_s.strip
@size = File.size(@target.path)
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/io_adapters/uploaded_file_adapter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class UploadedFile < OpenStruct; end

@file = UploadedFile.new(
:original_filename => "5k.png",
:content_type => "image/png",
:content_type => "image/png\r",
:head => "",
:tempfile => tempfile,
:path => tempfile.path
Expand Down

0 comments on commit eb92834

Please sign in to comment.