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
73865dbe
Commit
73865dbe
authored
Jul 17, 2015
by
Dave Gynn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prefer sub to gsub when possible
parent
55847347
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lib/paperclip/storage/s3.rb
+7
-7
No files found.
lib/paperclip/storage/s3.rb
View file @
73865dbe
...
...
@@ -157,9 +157,9 @@ module Paperclip
@s3_server_side_encryption
=
@options
[
:s3_server_side_encryption
]
end
unless
@options
[
:url
].
to_s
.
match
(
/\A:s3.*url\Z/
)
||
@options
[
:url
]
==
":asset_host"
@options
[
:path
]
=
path_option
.
gsub
(
/:url/
,
@options
[
:url
]).
gsub
(
/\A:rails_root\/public\/system/
,
''
)
@options
[
:url
]
=
":s3_path_url"
unless
@options
[
:url
].
to_s
.
match
(
/\A:s3.*url\Z/
)
||
@options
[
:url
]
==
":asset_host"
.
freeze
@options
[
:path
]
=
path_option
.
gsub
(
/:url/
,
@options
[
:url
]).
sub
(
/\A:rails_root\/public\/system/
,
""
.
freeze
)
@options
[
:url
]
=
":s3_path_url"
.
freeze
end
@options
[
:url
]
=
@options
[
:url
].
inspect
if
@options
[
:url
].
is_a?
(
Symbol
)
...
...
@@ -167,16 +167,16 @@ module Paperclip
end
Paperclip
.
interpolates
(
:s3_alias_url
)
do
|
attachment
,
style
|
"
#{
attachment
.
s3_protocol
(
style
,
true
)
}
//
#{
attachment
.
s3_host_alias
}
/
#{
attachment
.
path
(
style
).
g
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
"
#{
attachment
.
s3_protocol
(
style
,
true
)
}
//
#{
attachment
.
s3_host_alias
}
/
#{
attachment
.
path
(
style
).
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
end
unless
Paperclip
::
Interpolations
.
respond_to?
:s3_alias_url
Paperclip
.
interpolates
(
:s3_path_url
)
do
|
attachment
,
style
|
"
#{
attachment
.
s3_protocol
(
style
,
true
)
}
//
#{
attachment
.
s3_host_name
}
/
#{
attachment
.
bucket_name
}
/
#{
attachment
.
path
(
style
).
g
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
"
#{
attachment
.
s3_protocol
(
style
,
true
)
}
//
#{
attachment
.
s3_host_name
}
/
#{
attachment
.
bucket_name
}
/
#{
attachment
.
path
(
style
).
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
end
unless
Paperclip
::
Interpolations
.
respond_to?
:s3_path_url
Paperclip
.
interpolates
(
:s3_domain_url
)
do
|
attachment
,
style
|
"
#{
attachment
.
s3_protocol
(
style
,
true
)
}
//
#{
attachment
.
bucket_name
}
.
#{
attachment
.
s3_host_name
}
/
#{
attachment
.
path
(
style
).
g
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
"
#{
attachment
.
s3_protocol
(
style
,
true
)
}
//
#{
attachment
.
bucket_name
}
.
#{
attachment
.
s3_host_name
}
/
#{
attachment
.
path
(
style
).
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
end
unless
Paperclip
::
Interpolations
.
respond_to?
:s3_domain_url
Paperclip
.
interpolates
(
:asset_host
)
do
|
attachment
,
style
|
"
#{
attachment
.
path
(
style
).
g
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
"
#{
attachment
.
path
(
style
).
sub
(
%r{
\A
/}
,
""
.
freeze
)
}
"
end
unless
Paperclip
::
Interpolations
.
respond_to?
:asset_host
end
...
...
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