diff --git a/app/models/champs/piece_justificative_champ.rb b/app/models/champs/piece_justificative_champ.rb index 8f140c8e4..1ec10d2ab 100644 --- a/app/models/champs/piece_justificative_champ.rb +++ b/app/models/champs/piece_justificative_champ.rb @@ -49,7 +49,7 @@ class Champs::PieceJustificativeChamp < Champ end def for_api - if piece_justificative_file.attached? && virus_scan&.safe? + if piece_justificative_file.attached? && (virus_scan&.safe? || virus_scan&.pending?) Rails.application.routes.url_helpers.url_for(piece_justificative_file) end end diff --git a/spec/models/champs/piece_justificative_champ_spec.rb b/spec/models/champs/piece_justificative_champ_spec.rb index 3c44c791b..4c709090d 100644 --- a/spec/models/champs/piece_justificative_champ_spec.rb +++ b/spec/models/champs/piece_justificative_champ_spec.rb @@ -13,7 +13,7 @@ describe Champs::PieceJustificativeChamp do context 'when file is not scanned' do let(:status) { 'pending' } - it { is_expected.to be_nil } + it { is_expected.to include("/rails/active_storage/blobs/") } end context 'when file is infected' do