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
85936c75
Commit
85936c75
authored
Oct 05, 2011
by
Mike Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/iainbeeston/paperclip
parents
eadf7e82
cc89e4aa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
+8
-1
lib/paperclip/interpolations.rb
+1
-1
test/interpolations_test.rb
+7
-0
No files found.
lib/paperclip/interpolations.rb
View file @
85936c75
...
...
@@ -86,7 +86,7 @@ module Paperclip
# Returns the basename of the file. e.g. "file" for "file.jpg"
def
basename
attachment
,
style_name
attachment
.
original_filename
.
gsub
(
/
#{
File
.
extname
(
attachment
.
original_filename
)
}
$/
,
""
)
attachment
.
original_filename
.
gsub
(
/
#{
Regexp
.
escape
(
File
.
extname
(
attachment
.
original_filename
)
)
}
$/
,
""
)
end
# Returns the extension of the file. e.g. "jpg" for "file.jpg"
...
...
test/interpolations_test.rb
View file @
85936c75
...
...
@@ -155,6 +155,13 @@ class InterpolationsTest < Test::Unit::TestCase
assert_equal
"one"
,
Paperclip
::
Interpolations
.
filename
(
attachment
,
:style
)
end
should
"return the basename when the extension contains regexp special characters"
do
attachment
=
mock
attachment
.
stubs
(
:styles
).
returns
({})
attachment
.
stubs
(
:original_filename
).
returns
(
"one.ab)"
)
assert_equal
"one"
,
Paperclip
::
Interpolations
.
basename
(
attachment
,
:style
)
end
should
"return the timestamp"
do
now
=
Time
.
now
zone
=
'UTC'
...
...
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