From 25bcd51fce3af31942bc150e107d086f38db881d Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Mon, 13 May 2019 12:17:21 +0200 Subject: [PATCH] add log for virus_scanner --- app/lib/active_storage/virus_scanner.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/lib/active_storage/virus_scanner.rb b/app/lib/active_storage/virus_scanner.rb index e7ed91761..bfe41a773 100644 --- a/app/lib/active_storage/virus_scanner.rb +++ b/app/lib/active_storage/virus_scanner.rb @@ -35,12 +35,16 @@ class ActiveStorage::VirusScanner end def metadata - download_blob_to_tempfile do |file| - if ClamavService.safe_file?(file.path) - { virus_scan_result: SAFE, scanned_at: Time.zone.now } - else - { virus_scan_result: INFECTED, scanned_at: Time.zone.now } + begin + download_blob_to_tempfile do |file| + if ClamavService.safe_file?(file.path) + { virus_scan_result: SAFE, scanned_at: Time.zone.now } + else + { virus_scan_result: INFECTED, scanned_at: Time.zone.now } + end end + rescue StandardError => e + Raven.capture_exception(e) end end end