Skip to content

Commit

Permalink
Fix error when trying to delete already-deleted file with OpenStack S…
Browse files Browse the repository at this point in the history
…wift (#27569)
  • Loading branch information
ClearlyClaire committed Nov 27, 2023
1 parent 3c33d79 commit d01d51d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/lib/attachment_batch.rb
Expand Up @@ -75,7 +75,12 @@ def remove_files
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
Expand Down

0 comments on commit d01d51d

Please sign in to comment.