diff --git a/lib/Service/CollectiveService.php b/lib/Service/CollectiveService.php index b7ab2ccdc..fb937a7d8 100644 --- a/lib/Service/CollectiveService.php +++ b/lib/Service/CollectiveService.php @@ -8,7 +8,9 @@ use OCA\Collectives\Fs\NodeHelper; use OCA\Collectives\Mount\CollectiveRootPathHelper; use OCP\AppFramework\QueryException; +use OCP\Files\InvalidPathException; use OCP\Files\IRootFolder; +use OCP\Files\NotPermittedException; class CollectiveService { /** @var CollectiveMapper */ @@ -107,8 +109,8 @@ public function deleteCollective(string $userId, int $id): Collective { throw new NotFoundException('Circle not found: ' . $collective->getCircleUniqueId()); } - $collectiveFolder = $this->rootFolder->get($this->collectiveRootPathHelper->get() . '/' . $collective->getId()); try { + $collectiveFolder = $this->rootFolder->get($this->collectiveRootPathHelper->get() . '/' . $collective->getId()); $collectiveFolder->delete(); } catch (InvalidPathException | \OCP\Files\NotFoundException | NotPermittedException $e) { throw new NotFoundException('Failed to delete collective folder');