Module: Shrine::Plugins::ValidateVirusFree::AttacherMethods
- Defined in:
- lib/shrine/plugins/validate_virus_free.rb
Instance Method Summary collapse
Instance Method Details
#add_error_msg(message) ⇒ Object (private)
22 23 24 25 26 27 28 29 30 |
# File 'lib/shrine/plugins/validate_virus_free.rb', line 22 def add_error_msg() if Rails.env.development? && .match(/nodename nor servname provided/) Rails.logger.error('VIRUS SCANNING IS OFF. PLEASE START CLAMD') true else errors << ( || 'virus or malware detected') false end end |
#validate_virus_free(message: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/shrine/plugins/validate_virus_free.rb', line 10 def validate_virus_free(message: nil) Datadog::Tracing.trace('Scan Upload for Viruses') do file_to_scan = get.download temp_file_path = Common::FileHelpers.generate_clamav_temp_file(file_to_scan) result = Common::VirusScan.scan(temp_file_path) File.delete(temp_file_path) result || add_error_msg( || "Virus Found + #{temp_file_path}") end end |