Permalink
Browse files

Specify SSE correctly

  • Loading branch information...
1 parent 46387cf commit c9ee8b9e2670f28020a45d79b1fa17cde3161d82 @jyurek jyurek committed Dec 5, 2012
Showing with 10 additions and 6 deletions.
  1. +1 −1 Gemfile.lock
  2. +7 −3 lib/paperclip/storage/s3.rb
  3. +1 −1 paperclip.gemspec
  4. +1 −1 test/storage/s3_test.rb
View
@@ -180,7 +180,7 @@ DEPENDENCIES
activerecord-jdbcsqlite3-adapter
appraisal
aruba
- aws-sdk
+ aws-sdk (>= 1.2.0)
bourne
bundler
capybara
@@ -138,11 +138,12 @@ def sanitize_hash(hash)
@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 @@ def flush_writes #:nodoc:
: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)
View
@@ -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')
View
@@ -924,7 +924,7 @@ def counter
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

0 comments on commit c9ee8b9

Please sign in to comment.