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
7cb73846
Commit
7cb73846
authored
Mar 01, 2012
by
Jesse Cantara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewind files in flush_writes method of s3 and fog storage
parent
9e389588
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
0 deletions
+13
-0
lib/paperclip/storage/fog.rb
+1
-0
lib/paperclip/storage/s3.rb
+1
-0
test/storage/fog_test.rb
+5
-0
test/storage/s3_test.rb
+6
-0
No files found.
lib/paperclip/storage/fog.rb
View file @
7cb73846
...
...
@@ -77,6 +77,7 @@ module Paperclip
def
flush_writes
for
style
,
file
in
@queued_for_write
do
log
(
"saving
#{
path
(
style
)
}
"
)
file
.
rewind
retried
=
false
begin
directory
.
files
.
create
(
fog_file
.
merge
(
...
...
lib/paperclip/storage/s3.rb
View file @
7cb73846
...
...
@@ -281,6 +281,7 @@ module Paperclip
@queued_for_write
.
each
do
|
style
,
file
|
begin
log
(
"saving
#{
path
(
style
)
}
"
)
file
.
rewind
acl
=
@s3_permissions
[
style
]
||
@s3_permissions
[
:default
]
acl
=
acl
.
call
(
self
,
style
)
if
acl
.
respond_to?
(
:call
)
write_options
=
{
...
...
test/storage/fog_test.rb
View file @
7cb73846
...
...
@@ -116,6 +116,11 @@ class FogTest < Test::Unit::TestCase
assert_equal
0
,
@dummy
.
avatar
.
to_file
.
pos
end
should
"rewind file in flush_writes"
do
@dummy
.
avatar
.
queued_for_write
.
each
{
|
style
,
file
|
file
.
expects
(
:rewind
).
with
()
}
@dummy
.
save
end
should
"pass the content type to the Fog::Storage::AWS::Files instance"
do
Fog
::
Storage
::
AWS
::
Files
.
any_instance
.
expects
(
:create
).
with
do
|
hash
|
hash
[
:content_type
]
...
...
test/storage/s3_test.rb
View file @
7cb73846
...
...
@@ -341,6 +341,12 @@ class S3Test < Test::Unit::TestCase
@dummy
.
avatar
.
to_file
.
seek
(
10
)
assert_equal
0
,
@dummy
.
avatar
.
to_file
.
pos
end
should
"rewind file in flush_writes"
do
@dummy
.
avatar
.
queued_for_write
.
each
{
|
style
,
file
|
file
.
expects
(
:rewind
).
with
()
}
@dummy
.
save
end
end
context
"Generating a secure url with an expiration"
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