Module: UploaderVirusScan
- Extended by:
- ActiveSupport::Concern
- Included in:
- Form1010cg::PoaUploader, HCAAttachmentUploader, LighthouseDocumentUploaderBase, PreneedAttachmentUploader, SimpleFormsApi::FormRemediation::Uploader
- Defined in:
- app/uploaders/uploader_virus_scan.rb
Defined Under Namespace
Classes: VirusFoundError
Instance Method Summary collapse
Instance Method Details
#validate_virus_free(file) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/uploaders/uploader_virus_scan.rb', line 16 def validate_virus_free(file) return unless Rails.env.production? temp_file_path = Common::FileHelpers.generate_clamav_temp_file(file.read) result = Common::VirusScan.scan(temp_file_path) File.delete(temp_file_path) # Common::VirusScan result will return true or false unless result # unless safe file.delete raise VirusFoundError, "Virus Found + #{temp_file_path}" end end |