diff --git a/appinfo/info.xml b/appinfo/info.xml index f10b2b12..9cf4373e 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -31,7 +31,7 @@ More information is available in the Anti-Virus documentation. true Files_Antivirus - + 157439 diff --git a/lib/AvirWrapper.php b/lib/AvirWrapper.php index bf70404b..6eeb5ca9 100644 --- a/lib/AvirWrapper.php +++ b/lib/AvirWrapper.php @@ -13,6 +13,7 @@ use OCA\Files_Antivirus\Scanner\AbstractScanner; use OCA\Files_Antivirus\Scanner\InitException; use OCP\App; +use OCP\Files\ExcludeForbiddenException; use OCP\IL10N; use OCP\ILogger; use OCP\Files\InvalidContentException; @@ -138,7 +139,7 @@ function () use ($scanner, $path) { * @param AbstractScanner $scanner * @param string $path * @param bool $shouldDelete - * @throws InvalidContentException + * @throws ExcludeForbiddenException */ private function onScanComplete($scanner, $path, $shouldDelete){ $status = $scanner->completeAsyncScan(); @@ -178,11 +179,11 @@ private function onScanComplete($scanner, $path, $shouldDelete){ } } - throw new InvalidContentException( + throw new ExcludeForbiddenException( $this->l10n->t( 'Virus %s is detected in the file. Upload cannot be completed.', $status->getDetails() - ) + ), true ); } diff --git a/tests/unit/AvirWrapperTest.php b/tests/unit/AvirWrapperTest.php index 9f691804..8f8f5594 100644 --- a/tests/unit/AvirWrapperTest.php +++ b/tests/unit/AvirWrapperTest.php @@ -57,7 +57,7 @@ public function setUp() { } /** - * @expectedException \OCP\Files\InvalidContentException + * @expectedException \OCP\Files\ExcludeForbiddenException */ public function testInfectedFwrite(){ $wrapper = $this->getWrapper(); @@ -67,7 +67,7 @@ public function testInfectedFwrite(){ } /** - * @expectedException \OCP\Files\InvalidContentException + * @expectedException \OCP\Files\ExcludeForbiddenException */ public function testBigInfectedFwrite(){ $wrapper = $this->getWrapper();