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

Fixes #27568
  • Loading branch information
ClearlyClaire committed Oct 26, 2023
1 parent 9a3d047 commit e785c4b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/lib/attachment_batch.rb
Original file line number Diff line number Diff line change
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 e785c4b

Please sign in to comment.