From d03c14b6d3630254536e1b01a943d1a7abb15465 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 29 Jan 2025 14:27:48 +0100 Subject: [PATCH] =?UTF-8?q?fix(attachement):=20if=20champ=20attachement=20?= =?UTF-8?q?is=20already=20destroyed=20don=E2=80=99t=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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|