From 75255c01fccb68cd34b7503b798a8f72793f863f Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 26 Oct 2023 15:09:48 +0200 Subject: [PATCH] Fix error when trying to delete already-deleted file with OpenStack Swift (#27569) --- app/lib/attachment_batch.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/lib/attachment_batch.rb b/app/lib/attachment_batch.rb index 78bd593160..13a9da828f 100644 --- a/app/lib/attachment_batch.rb +++ b/app/lib/attachment_batch.rb @@ -75,7 +75,12 @@ class AttachmentBatch end when :fog logger.debug { "Deleting #{attachment.path(style)}" } - attachment.send(:directory).files.new(key: attachment.path(style)).destroy + + begin + attachment.send(:directory).files.new(key: attachment.path(style)).destroy + rescue Fog::Storage::OpenStack::NotFound + # Ignore failure to delete a file that has already been deleted + end when :azure logger.debug { "Deleting #{attachment.path(style)}" } attachment.destroy