From 7a25af64ddcfac1f4ad3fda2b6f72b03152b202e Mon Sep 17 00:00:00 2001 From: "S.H" Date: Mon, 26 Jun 2023 23:38:19 +0900 Subject: [PATCH] Remove media attachment only when file was exist (#25586) --- app/lib/attachment_batch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/attachment_batch.rb b/app/lib/attachment_batch.rb index 41dc36b64..6372b0131 100644 --- a/app/lib/attachment_batch.rb +++ b/app/lib/attachment_batch.rb @@ -64,7 +64,7 @@ class AttachmentBatch keys << attachment.style_name_as_path(style) when :filesystem logger.debug { "Deleting #{attachment.path(style)}" } - FileUtils.remove_file(attachment.path(style)) + FileUtils.remove_file(attachment.path(style), true) when :fog logger.debug { "Deleting #{attachment.path(style)}" } attachment.directory.files.new(key: attachment.path(style)).destroy