demarches-normaliennes/app/services/clamav_service.rb
2018-12-18 22:49:27 +01:00

14 lines
317 B
Ruby

class ClamavService
def self.safe_file?(file_path)
if Rails.env.development?
return true
end
FileUtils.chmod(0666, file_path)
client = ClamAV::Client.new
response = client.execute(ClamAV::Commands::ScanCommand.new(file_path))
response.first.class != ClamAV::VirusResponse
end
end