demarches-normaliennes/app/services/clamav_service.rb
2018-10-01 16:15:46 +02:00

20 lines
409 B
Ruby

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