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
3cc7ab7d
Commit
3cc7ab7d
authored
Dec 30, 2008
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied patch from Rob Anderton to fix some binmode and open file issues that regressed.
parent
9908421d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
lib/paperclip/attachment.rb
+3
-0
lib/paperclip/storage.rb
+1
-1
test/iostream_test.rb
+2
-1
No files found.
lib/paperclip/attachment.rb
View file @
3cc7ab7d
...
...
@@ -67,6 +67,7 @@ module Paperclip
if
uploaded_file
.
is_a?
(
Paperclip
::
Attachment
)
uploaded_file
=
uploaded_file
.
to_file
(
:original
)
close_uploaded_file
=
uploaded_file
.
respond_to?
(
:close
)
end
return
nil
unless
valid_assignment?
(
uploaded_file
)
...
...
@@ -93,6 +94,7 @@ module Paperclip
# Reset the file size if the original file was reprocessed.
instance_write
(
:file_size
,
uploaded_file
.
size
.
to_i
)
ensure
uploaded_file
.
close
if
close_uploaded_file
validate
end
...
...
@@ -212,6 +214,7 @@ module Paperclip
# the post-process again.
def
reprocess!
new_original
=
Tempfile
.
new
(
"paperclip-reprocess"
)
new_original
.
binmode
if
old_original
=
to_file
(
:original
)
new_original
.
write
(
old_original
.
read
)
new_original
.
rewind
...
...
lib/paperclip/storage.rb
View file @
3cc7ab7d
...
...
@@ -38,11 +38,11 @@ module Paperclip
def
flush_writes
#:nodoc:
logger
.
info
(
"[paperclip] Writing files for
#{
name
}
"
)
@queued_for_write
.
each
do
|
style
,
file
|
file
.
close
FileUtils
.
mkdir_p
(
File
.
dirname
(
path
(
style
)))
logger
.
info
(
"[paperclip] ->
#{
path
(
style
)
}
"
)
FileUtils
.
mv
(
file
.
path
,
path
(
style
))
FileUtils
.
chmod
(
0644
,
path
(
style
))
file
.
close
end
@queued_for_write
=
{}
end
...
...
test/iostream_test.rb
View file @
3cc7ab7d
...
...
@@ -20,7 +20,8 @@ class IOStreamTest < Test::Unit::TestCase
context
"and given a String"
do
setup
do
assert
@result
=
@file
.
stream_to
(
"/tmp/iostream.string.test"
)
FileUtils
.
mkdir_p
(
File
.
join
(
ROOT
,
'tmp'
))
assert
@result
=
@file
.
stream_to
(
File
.
join
(
ROOT
,
'tmp'
,
'iostream.string.test'
))
end
should
"return a File"
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