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
48736ce5
Commit
48736ce5
authored
May 04, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force Tempfile extension when creating a Tempfile
This should fix the problem on animated file detection. Fixes #851
parent
50635d35
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
9 deletions
+21
-9
NEWS
+2
-0
lib/paperclip/io_adapters/attachment_adapter.rb
+3
-1
lib/paperclip/io_adapters/file_adapter.rb
+3
-1
lib/paperclip/io_adapters/stringio_adapter.rb
+3
-1
lib/paperclip/io_adapters/uploaded_file_adapter.rb
+3
-1
lib/paperclip/tempfile.rb
+7
-5
No files found.
NEWS
View file @
48736ce5
Unreleased:
* Bug fix: ThumbnailProcessor now correctly detects and preserve animated GIF.
* Bug fix: File extension is now preserved in generated Tempfile from adapter.
* Bug fix: Uploading file with unicode file name now won't raise an error when
logging in the AWS is turned on.
* Bug fix: Task "paperclip:refresh:missing_styles" now work correctly.
...
...
lib/paperclip/io_adapters/attachment_adapter.rb
View file @
48736ce5
...
...
@@ -52,7 +52,9 @@ module Paperclip
end
def
copy_to_tempfile
(
src
)
dest
=
Tempfile
.
new
(
src
.
original_filename
)
extension
=
File
.
extname
(
src
.
original_filename
)
basename
=
File
.
basename
(
src
.
original_filename
,
extension
)
dest
=
Tempfile
.
new
([
basename
,
extension
])
dest
.
binmode
if
src
.
respond_to?
:copy_to_local_file
src
.
copy_to_local_file
(
:original
,
dest
.
path
)
...
...
lib/paperclip/io_adapters/file_adapter.rb
View file @
48736ce5
...
...
@@ -56,7 +56,9 @@ module Paperclip
private
def
copy_to_tempfile
(
src
)
dest
=
Tempfile
.
new
(
original_filename
)
extension
=
File
.
extname
(
original_filename
)
basename
=
File
.
basename
(
original_filename
,
extension
)
dest
=
Tempfile
.
new
([
basename
,
extension
])
dest
.
binmode
FileUtils
.
cp
(
src
.
path
,
dest
.
path
)
dest
...
...
lib/paperclip/io_adapters/stringio_adapter.rb
View file @
48736ce5
...
...
@@ -47,7 +47,9 @@ module Paperclip
private
def
copy_to_tempfile
(
src
)
dest
=
Tempfile
.
new
(
original_filename
)
extension
=
File
.
extname
(
original_filename
)
basename
=
File
.
basename
(
original_filename
,
extension
)
dest
=
Tempfile
.
new
([
basename
,
extension
])
dest
.
binmode
while
data
=
src
.
read
(
16
*
1024
)
dest
.
write
(
data
)
...
...
lib/paperclip/io_adapters/uploaded_file_adapter.rb
View file @
48736ce5
...
...
@@ -50,7 +50,9 @@ module Paperclip
private
def
copy_to_tempfile
(
src
)
dest
=
Tempfile
.
new
(
original_filename
)
extension
=
File
.
extname
(
original_filename
)
basename
=
File
.
basename
(
original_filename
,
extension
)
dest
=
Tempfile
.
new
([
basename
,
extension
])
dest
.
binmode
FileUtils
.
cp
(
src
.
path
,
dest
.
path
)
dest
...
...
lib/paperclip/tempfile.rb
View file @
48736ce5
...
...
@@ -7,14 +7,16 @@ module Paperclip
# taken from the comments on this blog post:
# http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions
#
# This is Ruby 1.
8.7
's implementation.
def
make_tmpname
(
basename
,
n
)
# This is Ruby 1.
9.3
's implementation.
def
make_tmpname
(
prefix_suffix
,
n
)
if
RUBY_PLATFORM
=~
/java/
case
basename
case
prefix_suffix
when
String
prefix
,
suffix
=
prefix_suffix
,
''
when
Array
prefix
,
suffix
=
*
basename
prefix
,
suffix
=
*
prefix_suffix
else
prefix
,
suffix
=
basename
,
''
raise
ArgumentError
,
"unexpected prefix_suffix:
#{
prefix_suffix
.
inspect
}
"
end
t
=
Time
.
now
.
strftime
(
"%y%m%d"
)
...
...
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