refactor: do not enqueue antivirus job for safe blob
This commit is contained in:
parent
b6a4f62184
commit
6982b2d5e8
2 changed files with 9 additions and 2 deletions
|
@ -15,6 +15,13 @@ module AttachmentVirusScannerConcern
|
|||
private
|
||||
|
||||
def scan_for_virus_later
|
||||
blob&.scan_for_virus_later
|
||||
return if blob.nil?
|
||||
|
||||
# do not scan if the blob is already marked as safe
|
||||
# usually because of metadata[:virus_scan_result] = ActiveStorage::VirusScanner::SAFE
|
||||
# added on a blob built by the application itself
|
||||
return if blob.virus_scan_result == ActiveStorage::VirusScanner::SAFE
|
||||
|
||||
blob.scan_for_virus_later
|
||||
end
|
||||
end
|
||||
|
|
|
@ -139,7 +139,7 @@ describe 'Instructing a dossier:', js: true do
|
|||
expect(page).to have_text("Export .csv d’un dossier « à suivre » demandé il y a moins d'une minute")
|
||||
expect(page).to have_text("En préparation")
|
||||
|
||||
assert_performed_jobs 2 do
|
||||
assert_performed_jobs 1 do
|
||||
perform_enqueued_jobs(only: ExportJob)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue