Fix error when trying to delete already-deleted file with OpenStack Swift (#27569)

shrike
Claire 2023-10-26 15:09:48 +02:00 committed by GitHub
parent 3427b51d63
commit 75255c01fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -75,7 +75,12 @@ class AttachmentBatch
end end
when :fog when :fog
logger.debug { "Deleting #{attachment.path(style)}" } logger.debug { "Deleting #{attachment.path(style)}" }
begin
attachment.send(:directory).files.new(key: attachment.path(style)).destroy 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 when :azure
logger.debug { "Deleting #{attachment.path(style)}" } logger.debug { "Deleting #{attachment.path(style)}" }
attachment.destroy attachment.destroy