Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

S3 uploads should have their content types set

  • Loading branch information...
commit aebbb7c485906680b353fb200693dedd8324c004 1 parent f756dd1
@jyurek jyurek authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  lib/paperclip/storage.rb
  2. +1 −1  test/storage_test.rb
View
2  lib/paperclip/storage.rb
@@ -165,7 +165,7 @@ def flush_writes #:nodoc:
logger.info("[paperclip] -> #{path(style)}")
key = s3_bucket.key(path(style))
key.data = file
- key.put(nil, @s3_permissions)
+ key.put(nil, @s3_permissions, {'Content-type' => instance_read(:content_type)})
rescue RightAws::AwsError => e
raise
end
View
2  test/storage_test.rb
@@ -97,7 +97,7 @@ class StorageTest < Test::Unit::TestCase
@key_mock = stub
@bucket_mock.expects(:key).returns(@key_mock)
@key_mock.expects(:data=)
- @key_mock.expects(:put)
+ @key_mock.expects(:put).with(nil, 'public-read', 'Content-type' => 'image/png')
@dummy.save
end

1 comment on commit aebbb7c

@thoughtless

This commit seems to be causing problems when the original file is converted to a different type. For example, I am uploading SVG files and converting them to PNG files. The PNG files are being set in S3 as "image/svg+xml".
In my model I have something like this: "styles => {:line_height => ["80x20>", :png]}"

Please sign in to comment.
Something went wrong with that request. Please try again.