From 394966273fa09f73711b90a2593de165300a5fc8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 21 Aug 2024 14:42:02 +0200 Subject: [PATCH] fix: catch all errors when getting rich workspace content Signed-off-by: Robin Appelman Signed-off-by: Christoph Wurst --- lib/DAV/WorkspacePlugin.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php index ecbec3f59a8..100cfef02b8 100644 --- a/lib/DAV/WorkspacePlugin.php +++ b/lib/DAV/WorkspacePlugin.php @@ -25,6 +25,7 @@ namespace OCA\Text\DAV; +use Exception; use OC\Files\Node\File; use OC\Files\Node\Folder; use OCA\DAV\Connector\Sabre\Directory; @@ -37,6 +38,7 @@ use OCP\Files\StorageNotAvailableException; use OCP\IConfig; use OCP\Lock\LockedException; +use Psr\Log\LoggerInterface; use Sabre\DAV\INode; use Sabre\DAV\PropFind; use Sabre\DAV\Server; @@ -55,16 +57,20 @@ class WorkspacePlugin extends ServerPlugin { /** @var IRootFolder */ private $rootFolder; + /** @var LoggerInterface */ + private $logger; + /** @var IConfig */ private $config; /** @var string|null */ private $userId; - public function __construct(WorkspaceService $workspaceService, IRootFolder $rootFolder, IConfig $config, $userId) { + public function __construct(WorkspaceService $workspaceService, IRootFolder $rootFolder, IConfig $config, LoggerInterface $logger, $userId) { $this->workspaceService = $workspaceService; $this->rootFolder = $rootFolder; $this->config = $config; + $this->logger = $logger; $this->userId = $userId; } @@ -123,6 +129,10 @@ public function propFind(PropFind $propFind, INode $node) { return $file->getContent(); } } catch (GenericFileException|NotPermittedException|LockedException) { + } catch (Exception $e) { + $this->logger->error($e->getMessage(), [ + 'exception' => $e, + ]); } return '';