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
95d7c4a1
Commit
95d7c4a1
authored
Jun 15, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always convert s3_protocol to string first
Fixes #883
parent
e90de5da
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
lib/paperclip/storage/s3.rb
+2
-2
test/storage/s3_test.rb
+16
-0
No files found.
lib/paperclip/storage/s3.rb
View file @
95d7c4a1
...
@@ -278,9 +278,9 @@ module Paperclip
...
@@ -278,9 +278,9 @@ module Paperclip
def
s3_protocol
(
style
=
default_style
)
def
s3_protocol
(
style
=
default_style
)
protocol
=
if
@s3_protocol
.
respond_to?
(
:call
)
protocol
=
if
@s3_protocol
.
respond_to?
(
:call
)
@s3_protocol
.
call
(
style
,
self
)
@s3_protocol
.
call
(
style
,
self
)
.
to_s
else
else
@s3_protocol
@s3_protocol
.
to_s
end
end
protocol
=
protocol
.
split
(
":"
).
first
+
":"
unless
protocol
.
empty?
protocol
=
protocol
.
split
(
":"
).
first
+
":"
unless
protocol
.
empty?
...
...
test/storage/s3_test.rb
View file @
95d7c4a1
...
@@ -144,6 +144,22 @@ class S3Test < Test::Unit::TestCase
...
@@ -144,6 +144,22 @@ class S3Test < Test::Unit::TestCase
end
end
end
end
context
":s3_protocol => :https"
do
setup
do
rebuild_model
:storage
=>
:s3
,
:s3_credentials
=>
{},
:s3_protocol
=>
:https
,
:bucket
=>
"bucket"
,
:path
=>
":attachment/:basename.:extension"
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
StringIO
.
new
(
"."
)
end
should
"return a url based on an S3 path"
do
assert_match
%r{^https://s3.amazonaws.com/bucket/avatars/stringio.txt}
,
@dummy
.
avatar
.
url
end
end
context
":s3_protocol => ''"
do
context
":s3_protocol => ''"
do
setup
do
setup
do
rebuild_model
:storage
=>
:s3
,
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