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
748332eb
Commit
748332eb
authored
Sep 15, 2011
by
Daniel Evans
Committed by
Prem Sichanugrist
Sep 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaning up the downloaded original file if it is a tempfile, such as it is with s3 storage.
parent
e526c86a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
lib/paperclip/attachment.rb
+1
-0
test/integration_test.rb
+16
-0
No files found.
lib/paperclip/attachment.rb
View file @
748332eb
...
...
@@ -291,6 +291,7 @@ module Paperclip
post_process
(
*
style_args
)
old_original
.
close
if
old_original
.
respond_to?
(
:close
)
old_original
.
unlink
if
old_original
.
respond_to?
(
:unlink
)
save
else
...
...
test/integration_test.rb
View file @
748332eb
...
...
@@ -71,6 +71,22 @@ class IntegrationTest < Test::Unit::TestCase
should
"change the timestamp"
do
assert_not_equal
@original_timestamp
,
@d2
.
avatar_updated_at
end
should
"clean up the old original if it is a tempfile"
do
original
=
@d2
.
avatar
.
to_file
(
:original
)
tf
=
Paperclip
::
Tempfile
.
new
(
'original'
)
tf
.
binmode
original
.
binmode
tf
.
write
(
original
.
read
)
original
.
close
tf
.
rewind
File
.
expects
(
:unlink
).
with
(
tf
.
instance_variable_get
(
:@tmpname
))
@d2
.
avatar
.
expects
(
:to_file
).
with
(
:original
).
returns
(
tf
)
@d2
.
avatar
.
reprocess!
end
end
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