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
818281d0
Commit
818281d0
authored
Apr 05, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #811 from brumm/master
Fixes AWS::S3::Errors::RequestTimeout on Model#save
parents
05cda021
74c88f1c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
2 deletions
+29
-2
lib/paperclip/io_adapters/attachment_adapter.rb
+1
-0
lib/paperclip/io_adapters/file_adapter.rb
+1
-0
lib/paperclip/io_adapters/uploaded_file_adapter.rb
+1
-0
test/attachment_adapter_test.rb
+6
-0
test/file_adapter_test.rb
+5
-0
test/uploaded_file_adapter_test.rb
+15
-2
No files found.
lib/paperclip/io_adapters/attachment_adapter.rb
View file @
818281d0
...
...
@@ -49,6 +49,7 @@ module Paperclip
def
copy_to_tempfile
(
src
)
dest
=
Tempfile
.
new
(
src
.
original_filename
)
dest
.
binmode
FileUtils
.
cp
(
src
.
path
(
:original
),
dest
.
path
)
dest
end
...
...
lib/paperclip/io_adapters/file_adapter.rb
View file @
818281d0
...
...
@@ -57,6 +57,7 @@ module Paperclip
def
copy_to_tempfile
(
src
)
dest
=
Tempfile
.
new
(
original_filename
)
dest
.
binmode
FileUtils
.
cp
(
src
.
path
,
dest
.
path
)
dest
end
...
...
lib/paperclip/io_adapters/uploaded_file_adapter.rb
View file @
818281d0
...
...
@@ -51,6 +51,7 @@ module Paperclip
def
copy_to_tempfile
(
src
)
dest
=
Tempfile
.
new
(
original_filename
)
dest
.
binmode
FileUtils
.
cp
(
src
.
path
,
dest
.
path
)
dest
end
...
...
test/attachment_adapter_test.rb
View file @
818281d0
...
...
@@ -5,6 +5,8 @@ class AttachmentAdapterTest < Test::Unit::TestCase
rebuild_model
:path
=>
"tmp/:class/:attachment/:style/:filename"
@attachment
=
Dummy
.
new
.
avatar
@file
=
File
.
new
(
fixture_file
(
"5k.png"
))
@file
.
binmode
@attachment
.
assign
(
@file
)
@attachment
.
save
@subject
=
Paperclip
.
io_adapters
.
for
(
@attachment
)
...
...
@@ -14,6 +16,10 @@ class AttachmentAdapterTest < Test::Unit::TestCase
assert_equal
"5k.png"
,
@subject
.
original_filename
end
should
"force binmode on tempfile"
do
assert
@subject
.
instance_variable_get
(
"@tempfile"
).
binmode?
end
should
"get the content type"
do
assert_equal
"image/png"
,
@subject
.
content_type
end
...
...
test/file_adapter_test.rb
View file @
818281d0
...
...
@@ -4,6 +4,7 @@ class FileAdapterTest < Test::Unit::TestCase
context
"a new instance"
do
setup
do
@file
=
File
.
new
(
fixture_file
(
"5k.png"
))
@file
.
binmode
@subject
=
Paperclip
.
io_adapters
.
for
(
@file
)
end
...
...
@@ -11,6 +12,10 @@ class FileAdapterTest < Test::Unit::TestCase
assert_equal
"5k.png"
,
@subject
.
original_filename
end
should
"force binmode on tempfile"
do
assert
@subject
.
instance_variable_get
(
"@tempfile"
).
binmode?
end
should
"get the content type"
do
assert_equal
"image/png"
,
@subject
.
content_type
end
...
...
test/uploaded_file_adapter_test.rb
View file @
818281d0
...
...
@@ -5,11 +5,14 @@ class UploadedFileAdapterTest < Test::Unit::TestCase
context
"with UploadedFile responding to #tempfile"
do
setup
do
class
UploadedFile
<
OpenStruct
;
end
tempfile
=
File
.
new
(
fixture_file
(
"5k.png"
))
tempfile
.
binmode
@file
=
UploadedFile
.
new
(
:original_filename
=>
"5k.png"
,
:content_type
=>
"image/png"
,
:head
=>
""
,
:tempfile
=>
File
.
new
(
fixture_file
(
"5k.png"
))
:tempfile
=>
tempfile
)
@subject
=
Paperclip
.
io_adapters
.
for
(
@file
)
end
...
...
@@ -18,6 +21,10 @@ class UploadedFileAdapterTest < Test::Unit::TestCase
assert_equal
"5k.png"
,
@subject
.
original_filename
end
should
"force binmode on tempfile"
do
assert
@subject
.
instance_variable_get
(
"@tempfile"
).
binmode?
end
should
"get the content type"
do
assert_equal
"image/png"
,
@subject
.
content_type
end
...
...
@@ -58,6 +65,10 @@ class UploadedFileAdapterTest < Test::Unit::TestCase
assert_equal
"5k.png"
,
@subject
.
original_filename
end
should
"force binmode on tempfile"
do
assert
@subject
.
instance_variable_get
(
"@tempfile"
).
binmode?
end
should
"get the content type"
do
assert_equal
"image/png"
,
@subject
.
content_type
end
...
...
@@ -76,7 +87,9 @@ class UploadedFileAdapterTest < Test::Unit::TestCase
end
should
"read the contents of the file"
do
expected
=
File
.
new
(
@file
.
path
).
read
expected_file
=
File
.
new
(
@file
.
path
)
expected_file
.
binmode
expected
=
expected_file
.
read
assert
expected
.
length
>
0
assert_equal
expected
,
@subject
.
read
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