From c0062efbb4844c065704191b6a15e6e2d1ea83d5 Mon Sep 17 00:00:00 2001 From: Vasily Fedoseyev Date: Sat, 6 Apr 2024 16:36:55 +0300 Subject: [PATCH] =?UTF-8?q?=20=D0=9F=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=B5=D0=B5=20=D0=BF=D0=BE=20respond=5Fto,=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=20=D1=81=D0=BC?= =?UTF-8?q?=D0=B5=D1=81=D0=B8=20[Paperclip::]Tempfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/paperclip/attachment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/paperclip/attachment.rb b/lib/paperclip/attachment.rb index b66a1a5..1a9c318 100644 --- a/lib/paperclip/attachment.rb +++ b/lib/paperclip/attachment.rb @@ -316,7 +316,7 @@ module Paperclip def reprocess! new_original = Tempfile.new("paperclip-reprocess-#{instance.class.table_name}-#{instance.id}-") new_original.binmode - old_original = to_file(:original) + old_original = to_file(:original) || raise("no original in store") # по идее копирование нужно не всегда new_original.write( old_original.read ) new_original.flush @@ -439,7 +439,7 @@ module Paperclip queued_for_write[name] = args[:processors].inject(queued_for_write[:original]) do |file, processor| Paperclip.processor(processor).make(file, args, self).tap do |new_file| # closing intermediary tempfiles - file.close! if new_file != file && file.is_a?(Tempfile) && + file.close! if new_file != file && file.respond_to?(:close!) && (name == :original || !queued_for_write.value?(file)) end end