Commit 5a06d850 by Anders Lemke Committed by Jon Yurek

Preserve files when reprocessing

When using S3 for storage, their data consistency model makes the
current behaviour of Attachment#reprocess! unreliable.

Apparently, Amazon can not guarantee that PUT's called after DELETE's
is actually executed in that order.

Hence, I propose preserving files, when doing a reprocces.
parent 0ac38e9f
...@@ -314,6 +314,7 @@ module Paperclip ...@@ -314,6 +314,7 @@ module Paperclip
# the post-process again. # the post-process again.
def reprocess!(*style_args) def reprocess!(*style_args)
saved_only_process, @options[:only_process] = @options[:only_process], style_args saved_only_process, @options[:only_process] = @options[:only_process], style_args
saved_preserve_files, @options[:preserve_files] = @options[:preserve_files], true
begin begin
assign(self) assign(self)
save save
...@@ -323,6 +324,7 @@ module Paperclip ...@@ -323,6 +324,7 @@ module Paperclip
false false
ensure ensure
@options[:only_process] = saved_only_process @options[:only_process] = saved_only_process
@options[:preserve_files] = saved_preserve_files
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment