Commit c9ee8b9e by Jon Yurek

Specify SSE correctly

parent 46387cf7
......@@ -180,7 +180,7 @@ DEPENDENCIES
activerecord-jdbcsqlite3-adapter
appraisal
aruba
aws-sdk
aws-sdk (>= 1.2.0)
bourne
bundler
capybara
......
......@@ -138,11 +138,12 @@ module Paperclip
@s3_headers[:storage_class] = @options[:s3_storage_class] if @options[:s3_storage_class]
@s3_server_side_encryption = :aes256
if @options[:s3_server_side_encryption].blank?
@options[:s3_server_side_encryption] = false
@s3_server_side_encryption = false
end
if @options[:s3_server_side_encryption]
@s3_headers['x-amz-server-side-encryption'] = @options[:s3_server_side_encryption].to_s.upcase
if @s3_server_side_encryption
@s3_server_side_encryption = @options[:s3_server_side_encryption].to_s.upcase
end
unless @options[:url].to_s.match(/^:s3.*url$/) || @options[:url] == ":asset_host"
......@@ -306,6 +307,9 @@ module Paperclip
:content_type => file.content_type,
:acl => acl
}
if @s3_server_side_encryption
write_options[:server_side_encryption] = @s3_server_side_encryption
end
write_options[:metadata] = @s3_metadata unless @s3_metadata.empty?
write_options.merge!(@s3_headers)
s3_object(style).write(file, write_options)
......
......@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('shoulda')
s.add_development_dependency('appraisal')
s.add_development_dependency('mocha')
s.add_development_dependency('aws-sdk')
s.add_development_dependency('aws-sdk', '>= 1.2.0')
s.add_development_dependency('bourne')
s.add_development_dependency('sqlite3', '~> 1.3.4')
s.add_development_dependency('cucumber', '~> 1.2.1')
......
......@@ -924,7 +924,7 @@ class S3Test < Test::Unit::TestCase
object.expects(:write).with(anything,
:content_type => "image/png",
:acl => :public_read,
'x-amz-server-side-encryption' => 'AES256')
:server_side_encryption => 'AES256')
@dummy.save
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment