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
a1d03756
Commit
a1d03756
authored
Apr 29, 2008
by
Mark Van Holstyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure paths with multiple .'s work properly
parent
1fcf1d7e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletions
+10
-1
lib/paperclip/attachment.rb
+1
-1
test/test_attachment.rb
+9
-0
No files found.
lib/paperclip/attachment.rb
View file @
a1d03756
...
...
@@ -137,7 +137,7 @@ module Paperclip
attachment
.
instance
.
class
.
name
.
underscore
.
pluralize
end
,
:basename
=>
lambda
do
|
attachment
,
style
|
attachment
.
original_filename
.
gsub
(
/\.(.*?)$/
,
""
)
attachment
.
original_filename
.
gsub
(
File
.
extname
(
attachment
.
original_filename
)
,
""
)
end
,
:extension
=>
lambda
do
|
attachment
,
style
|
((
style
=
attachment
.
styles
[
style
])
&&
style
.
last
)
||
...
...
test/test_attachment.rb
View file @
a1d03756
...
...
@@ -111,6 +111,15 @@ class AttachmentTest < Test::Unit::TestCase
assert_equal
"/tests/blah/missing.png"
,
@attachment
.
url
(
:blah
)
end
should
"return the proper path when filename has a single .'s"
do
assert_equal
"./test/../tmp/tests/dummies/original/41/5k.png"
,
@attachment
.
path
end
should
"return the proper path when filename has multiple .'s"
do
@instance
.
stubs
(
:[]
).
with
(
:test_file_name
).
returns
(
"5k.old.png"
)
assert_equal
"./test/../tmp/tests/dummies/original/41/5k.old.png"
,
@attachment
.
path
end
context
"when expecting three styles"
do
setup
do
styles
=
{
:styles
=>
{
:large
=>
[
"400x400"
,
:png
],
...
...
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