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 (mastodon#27569)
  • Loading branch information
ClearlyClaire authored and vmstan committed Dec 14, 2023
1 parent e203506 commit 5e8dd71
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 5e8dd71

Please sign in to comment.