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
d0eda83d
Commit
d0eda83d
authored
Jul 27, 2012
by
Martin Streicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change option processing to be more compatible with previous versions. Add test.
parent
1b6b4673
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
lib/paperclip/storage/s3.rb
+4
-2
test/storage/s3_test.rb
+40
-0
No files found.
lib/paperclip/storage/s3.rb
View file @
d0eda83d
...
...
@@ -137,8 +137,10 @@ module Paperclip
end
@s3_headers
[
:storage_class
]
=
@options
[
:s3_storage_class
]
if
@options
[
:s3_storage_class
]
@s3_headers
[
'x-amz-server-side-encryption'
]
=
@options
[
:s3_server_side_encryption
].
to_s
.
upcase
if
@options
[
:s3_server_side_encryption
]
if
@options
[
:s3_server_side_encryption
]
&&
@options
[
:s3_server_side_encryption
]
!=
''
@s3_headers
[
'x-amz-server-side-encryption'
]
=
@options
[
:s3_server_side_encryption
].
to_s
.
upcase
end
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/
,
''
)
...
...
test/storage/s3_test.rb
View file @
d0eda83d
...
...
@@ -856,6 +856,46 @@ class S3Test < Test::Unit::TestCase
end
end
context
"Can disable AES256 encryption multiple ways"
do
[
nil
,
false
,
''
].
each
do
|
tech
|
setup
do
rebuild_model
(
:storage
=>
:s3
,
:bucket
=>
"testing"
,
:path
=>
":attachment/:style/:basename.:extension"
,
:s3_credentials
=>
{
'access_key_id'
=>
"12345"
,
'secret_access_key'
=>
"54321"
},
:s3_server_side_encryption
=>
tech
)
end
context
"when assigned"
do
setup
do
@file
=
File
.
new
(
fixture_file
(
'5k.png'
),
'rb'
)
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
@file
end
teardown
{
@file
.
close
}
context
"and saved"
do
setup
do
object
=
stub
@dummy
.
avatar
.
stubs
(
:s3_object
).
returns
(
object
)
object
.
expects
(
:write
).
with
(
anything
,
:content_type
=>
"image/png"
,
:acl
=>
:public_read
)
@dummy
.
save
end
should
"succeed"
do
assert
true
end
end
end
end
end
context
"An attachment with S3 storage and using AES256 encryption"
do
setup
do
rebuild_model
:storage
=>
:s3
,
...
...
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