Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(attachement): if champ attachement is already destroyed don’t crash #11272

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/controllers/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

if champ?
@attachment = champ.piece_justificative_file.find { _1.blob.id == @blob.id }
@attachment&.purge_later
champ.piece_justificative_file.reload

Check warning on line 27 in app/controllers/attachments_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/attachments_controller.rb#L26-L27

Added lines #L26 - L27 were not covered by tests
else
@attachment.purge_later

Check warning on line 29 in app/controllers/attachments_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/attachments_controller.rb#L29

Added line #L29 was not covered by tests
@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|
Expand Down
Loading