Commit 65e0338f by Luke Griffiths

s3_encryption => true is now s3_server_side_encryption => :aes256

parent af6d343e
...@@ -115,7 +115,7 @@ module Paperclip ...@@ -115,7 +115,7 @@ module Paperclip
@s3_headers[:storage_class] = @options[:s3_storage_class] if @options[:s3_storage_class] @s3_headers[:storage_class] = @options[:s3_storage_class] if @options[:s3_storage_class]
@s3_encrypted = @options[:s3_encrypted] @s3_server_side_encryption = @options[:s3_server_side_encryption]
unless @options[:url].to_s.match(/^:s3.*url$/) || @options[:url] == ":asset_host" unless @options[:url].to_s.match(/^:s3.*url$/) || @options[:url] == ":asset_host"
@options[:path] = @options[:path].gsub(/:url/, @options[:url]).gsub(/^:rails_root\/public\/system/, '') @options[:path] = @options[:path].gsub(/:url/, @options[:url]).gsub(/^:rails_root\/public\/system/, '')
...@@ -283,7 +283,9 @@ module Paperclip ...@@ -283,7 +283,9 @@ module Paperclip
:acl => acl :acl => acl
} }
write_options[:metadata] = @s3_metadata unless @s3_metadata.empty? write_options[:metadata] = @s3_metadata unless @s3_metadata.empty?
write_options[:server_side_encryption] = :aes256 if @s3_encrypted unless @s3_server_side_encryption.blank?
write_options[:server_side_encryption] = @s3_server_side_encryption
end
write_options.merge!(@s3_headers) write_options.merge!(@s3_headers)
s3_object(style).write(file, write_options) s3_object(style).write(file, write_options)
rescue AWS::S3::Errors::NoSuchBucket => e rescue AWS::S3::Errors::NoSuchBucket => e
......
...@@ -142,7 +142,7 @@ unless ENV["S3_BUCKET"].blank? ...@@ -142,7 +142,7 @@ unless ENV["S3_BUCKET"].blank?
:bucket => ENV["S3_BUCKET"], :bucket => ENV["S3_BUCKET"],
:path => ":class/:attachment/:id/:style.:extension", :path => ":class/:attachment/:id/:style.:extension",
:s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml")), :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml")),
:s3_encrypted => true :s3_server_side_encryption => :aes256
Dummy.delete_all Dummy.delete_all
@dummy = Dummy.new @dummy = Dummy.new
...@@ -165,7 +165,7 @@ unless ENV["S3_BUCKET"].blank? ...@@ -165,7 +165,7 @@ unless ENV["S3_BUCKET"].blank?
end end
should "be encrypted on S3" do should "be encrypted on S3" do
assert @dummy.avatar.s3_object.server_side_encryption? assert @dummy.avatar.s3_object.server_side_encryption == :aes256
end end
end end
end end
......
...@@ -693,7 +693,7 @@ class S3Test < Test::Unit::TestCase ...@@ -693,7 +693,7 @@ class S3Test < Test::Unit::TestCase
'access_key_id' => "12345", 'access_key_id' => "12345",
'secret_access_key' => "54321" 'secret_access_key' => "54321"
}, },
:s3_encrypted => true :s3_server_side_encryption => :aes256
end end
context "when assigned" do context "when assigned" do
......
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