Module: UploaderVirusScan
- Extended by:
- ActiveSupport::Concern
- 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 |
# 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_temp_file(file.read) result = Common::VirusScan.scan(temp_file_path) File.delete(temp_file_path) unless result.safe? file.delete raise VirusFoundError, result.body end end |