add log for virus_scanner (#3859)

Remonte les informations en cas d'erreur lors de l'exécution de l'antivirus
This commit is contained in:
Pierre de La Morinerie 2019-05-13 12:33:10 +02:00 committed by GitHub
commit e4517c7e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,7 @@ class ActiveStorage::VirusScanner
end
def metadata
begin
download_blob_to_tempfile do |file|
if ClamavService.safe_file?(file.path)
{ virus_scan_result: SAFE, scanned_at: Time.zone.now }
@ -42,5 +43,8 @@ class ActiveStorage::VirusScanner
{ virus_scan_result: INFECTED, scanned_at: Time.zone.now }
end
end
rescue StandardError => e
Raven.capture_exception(e)
end
end
end