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
07e0330e
Commit
07e0330e
authored
Jul 08, 2014
by
Pablo Cantero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test case for protocol-relative URL
parent
a424b82d
Hide 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
spec/paperclip/storage/s3_spec.rb
+16
-0
No files found.
lib/paperclip/storage/s3.rb
View file @
07e0330e
...
...
@@ -26,7 +26,7 @@ module Paperclip
# put your bucket name in this file, instead of adding it to the code directly.
# This is useful when you want the same account but a different bucket for
# development versus production.
# When using a Proc it provides a single parameter which is the attachment itself. A
# When using a Proc it provides a single parameter which is the attachment itself. A
# method #instance is available on the attachment which will take you back to your
# code. eg.
# class User
...
...
@@ -51,7 +51,7 @@ module Paperclip
# :s3_permissions => :private
#
# * +s3_protocol+: The protocol for the URLs generated to your S3 assets. Can be either
# 'http', 'https', or an empty string to generate
scheme-less
URLs. Defaults to 'http'
# 'http', 'https', or an empty string to generate
protocol-relative
URLs. Defaults to 'http'
# when your :s3_permissions are :public_read (the default), and 'https' when your
# :s3_permissions are anything else.
# * +s3_headers+: A hash of headers or a Proc. You may specify a hash such as
...
...
spec/paperclip/storage/s3_spec.rb
View file @
07e0330e
...
...
@@ -152,6 +152,22 @@ describe Paperclip::Storage::S3 do
end
end
context
"s3_protocol: ''"
do
before
do
rebuild_model
storage: :s3
,
s3_credentials:
{},
s3_protocol:
''
,
bucket:
"bucket"
,
path:
":attachment/:basename:dotextension"
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
stringy_file
end
it
"returns a protocol-relative URL"
do
assert_match
%r{^//s3.amazonaws.com/bucket/avatars/data[^
\.
]}
,
@dummy
.
avatar
.
url
end
end
context
"s3_protocol: :https"
do
before
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