From 1a3c19f48c59d28d32ab337fd360f2e59054c9f9 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 14 Apr 2016 16:50:13 +0200 Subject: [PATCH] First test --- Gemfile | 2 ++ Gemfile.lock | 2 ++ app/services/clamav_service.rb | 6 ++++++ app/services/pieces_justificatives_service.rb | 4 ++++ 4 files changed, 14 insertions(+) create mode 100644 app/services/clamav_service.rb diff --git a/Gemfile b/Gemfile index 5925ecca5..378447a6f 100644 --- a/Gemfile +++ b/Gemfile @@ -53,6 +53,8 @@ gem 'openid_connect' gem 'rest-client' +gem 'clamav-client', require: 'clamav/client' + gem 'carrierwave' gem 'pg' diff --git a/Gemfile.lock b/Gemfile.lock index 1f50835fc..f21a7f26f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,6 +100,7 @@ GEM chartkick (1.3.2) childprocess (0.5.5) ffi (~> 1.0, >= 1.0.11) + clamav-client (3.0.0) cliver (0.3.2) coderay (1.1.0) coffee-rails (4.1.0) @@ -489,6 +490,7 @@ DEPENDENCIES capybara carrierwave chartkick + clamav-client coffee-rails (~> 4.1.0) css_splitter database_cleaner diff --git a/app/services/clamav_service.rb b/app/services/clamav_service.rb new file mode 100644 index 000000000..c1391d3f7 --- /dev/null +++ b/app/services/clamav_service.rb @@ -0,0 +1,6 @@ +class ClamavService + def self.safe_file? path + + + end +end \ No newline at end of file diff --git a/app/services/pieces_justificatives_service.rb b/app/services/pieces_justificatives_service.rb index 0bb11d0d9..f7188a55d 100644 --- a/app/services/pieces_justificatives_service.rb +++ b/app/services/pieces_justificatives_service.rb @@ -13,6 +13,10 @@ class PiecesJustificativesService unless piece_justificative.save errors << piece_justificative.errors.messages[:content][0]+" (#{piece_justificative.libelle})"+"
" end + + unless ClamavService.safe_file? piece_justificative.content + + end end end errors