Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
65e0338f
Commit
65e0338f
authored
Jan 18, 2012
by
Luke Griffiths
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s3_encryption => true is now s3_server_side_encryption => :aes256
parent
af6d343e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
lib/paperclip/storage/s3.rb
+4
-2
test/storage/s3_live_test.rb
+2
-2
test/storage/s3_test.rb
+1
-1
No files found.
lib/paperclip/storage/s3.rb
View file @
65e0338f
...
@@ -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
...
...
test/storage/s3_live_test.rb
View file @
65e0338f
...
@@ -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
...
...
test/storage/s3_test.rb
View file @
65e0338f
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment