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
484ddddc
Commit
484ddddc
authored
Apr 08, 2011
by
Chad Pytel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for styles in expiring_url for S3 objects
Conflicts: lib/paperclip/storage/s3.rb test/storage_test.rb
parent
435ecba0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
lib/paperclip/storage/s3.rb
+2
-2
test/storage_test.rb
+5
-3
No files found.
lib/paperclip/storage/s3.rb
View file @
484ddddc
...
...
@@ -94,8 +94,8 @@ module Paperclip
end
unless
Paperclip
::
Interpolations
.
respond_to?
:s3_domain_url
end
def
expiring_url
(
time
=
3600
)
AWS
::
S3
::
S3Object
.
url_for
(
path
,
bucket_name
,
:expires_in
=>
time
,
:use_ssl
=>
(
s3_protocol
==
'https'
))
def
expiring_url
(
time
=
3600
,
style_name
=
default_style
)
AWS
::
S3
::
S3Object
.
url_for
(
path
(
style_name
)
,
bucket_name
,
:expires_in
=>
time
,
:use_ssl
=>
(
s3_protocol
==
'https'
))
end
def
bucket_name
...
...
test/storage_test.rb
View file @
484ddddc
...
...
@@ -151,7 +151,7 @@ class StorageTest < Test::Unit::TestCase
:development
=>
{
:bucket
=>
"dev_bucket"
}
},
:s3_host_alias
=>
"something.something.com"
,
:path
=>
":attachment/:basename.:extension"
,
:path
=>
":attachment/:
style/:
basename.:extension"
,
:url
=>
":s3_alias_url"
rails_env
(
"production"
)
...
...
@@ -159,9 +159,11 @@ class StorageTest < Test::Unit::TestCase
@dummy
=
Dummy
.
new
@dummy
.
avatar
=
StringIO
.
new
(
"."
)
AWS
::
S3
::
S3Object
.
expects
(
:url_for
).
with
(
"avatars/stringio.txt"
,
"prod_bucket"
,
{
:expires_in
=>
3600
,
:use_ssl
=>
false
})
AWS
::
S3
::
S3Object
.
expects
(
:url_for
).
with
(
"avatars/original/stringio.txt"
,
"prod_bucket"
,
{
:expires_in
=>
3600
,
:use_ssl
=>
false
})
@dummy
.
avatar
.
expiring_url
AWS
::
S3
::
S3Object
.
expects
(
:url_for
).
with
(
"avatars/thumb/stringio.txt"
,
"prod_bucket"
,
{
:expires_in
=>
1800
,
:use_ssl
=>
false
})
@dummy
.
avatar
.
expiring_url
(
1800
,
:thumb
)
end
should
"should succeed"
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