Commit 986d9dd7 authored by Predhumeau Manon's avatar Predhumeau Manon
Browse files

Corrections in virusListener code

parent 509ce18a
1 merge request!1Add antivirus analyse (xenelop quahog)
Showing with 6 additions and 10 deletions
+6 -10
......@@ -33,15 +33,16 @@ class VirusScannerListener
/**
* @param FileUploadCompleteEvent $event
* @throws ConnectionException
*/
public function onFileUploadCompleted(FileUploadCompleteEvent $event)
{
$this->client = $this->getClient();
$client = $this->getClient();
$file = $event->getUploadedFile();
$path = $file->getLocalPath();
$result = $this->client->scanFile($path);
$result = $client->scanFile($path);
$hasVirus = $result['status'] === Client::RESULT_FOUND;
$meta = $file->getMetadata();
......@@ -65,13 +66,8 @@ class VirusScannerListener
*/
private function getClient(): Client
{
try {
// Check clamd server's state
$this->client->ping();
return $this->client;
} catch (ConnectionException $connectionException) {
throw $connectionException;
}
// Check clamd server's state
$this->client->ping();
return $this->client;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment