Skip to content
This repository
Browse code

s3_encryption => true is now s3_server_side_encryption => :aes256

  • Loading branch information...
commit 65e0338f3ed07ddf95958ce71265a0ba76e9c1c6 1 parent af6d343
Luke Griffiths authored January 18, 2012
6  lib/paperclip/storage/s3.rb
@@ -115,7 +115,7 @@ def self.extended base
115 115
 
116 116
           @s3_headers[:storage_class] = @options[:s3_storage_class] if @options[:s3_storage_class]
117 117
 
118  
-          @s3_encrypted = @options[:s3_encrypted]
  118
+          @s3_server_side_encryption = @options[:s3_server_side_encryption]
119 119
 
120 120
           unless @options[:url].to_s.match(/^:s3.*url$/) || @options[:url] == ":asset_host"
121 121
             @options[:path] = @options[:path].gsub(/:url/, @options[:url]).gsub(/^:rails_root\/public\/system/, '')
@@ -283,7 +283,9 @@ def flush_writes #:nodoc:
283 283
               :acl => acl
284 284
             }
285 285
             write_options[:metadata] = @s3_metadata unless @s3_metadata.empty?
286  
-            write_options[:server_side_encryption] = :aes256 if @s3_encrypted
  286
+            unless @s3_server_side_encryption.blank?
  287
+              write_options[:server_side_encryption] = @s3_server_side_encryption
  288
+            end
287 289
             write_options.merge!(@s3_headers)
288 290
             s3_object(style).write(file, write_options)
289 291
           rescue AWS::S3::Errors::NoSuchBucket => e
4  test/storage/s3_live_test.rb
@@ -142,7 +142,7 @@ class S3LiveTest < Test::Unit::TestCase
142 142
                       :bucket => ENV["S3_BUCKET"],
143 143
                       :path => ":class/:attachment/:id/:style.:extension",
144 144
                       :s3_credentials => File.new(File.join(File.dirname(__FILE__), "..", "fixtures", "s3.yml")),
145  
-                      :s3_encrypted => true
  145
+                      :s3_server_side_encryption => :aes256
146 146
 
147 147
         Dummy.delete_all
148 148
         @dummy = Dummy.new
@@ -165,7 +165,7 @@ class S3LiveTest < Test::Unit::TestCase
165 165
           end
166 166
 
167 167
           should "be encrypted on S3" do
168  
-            assert @dummy.avatar.s3_object.server_side_encryption?
  168
+            assert @dummy.avatar.s3_object.server_side_encryption == :aes256
169 169
           end
170 170
         end
171 171
       end
2  test/storage/s3_test.rb
@@ -693,7 +693,7 @@ def counter
693 693
                       'access_key_id' => "12345",
694 694
                       'secret_access_key' => "54321"
695 695
                     },
696  
-                    :s3_encrypted => true
  696
+                    :s3_server_side_encryption => :aes256
697 697
     end
698 698
 
699 699
     context "when assigned" do

0 notes on commit 65e0338

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