diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 6204964ad9e..c66e3cbf98d 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -23,13 +23,13 @@ def destroy if champ? @attachment = champ.piece_justificative_file.find { _1.blob.id == @blob.id } + @attachment&.purge_later + champ.piece_justificative_file.reload else + @attachment.purge_later @attachment_options = attachment_options end - @attachment.purge_later - @champ.piece_justificative_file.reload if champ? - flash.notice = 'La pièce jointe a bien été supprimée.' respond_to do |format|