From a4c32a124b8eed4c0e6f6c279cea7ecc98f0e76b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 31 Jul 2024 13:57:21 +0200 Subject: [PATCH] fix: Avoid throwing exceptions during propfind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/DAV/WorkspacePlugin.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php index 2967833f688..ecbec3f59a8 100644 --- a/lib/DAV/WorkspacePlugin.php +++ b/lib/DAV/WorkspacePlugin.php @@ -31,9 +31,12 @@ use OCA\DAV\Files\FilesHome; use OCA\Text\AppInfo\Application; use OCA\Text\Service\WorkspaceService; +use OCP\Files\GenericFileException; use OCP\Files\IRootFolder; +use OCP\Files\NotPermittedException; use OCP\Files\StorageNotAvailableException; use OCP\IConfig; +use OCP\Lock\LockedException; use Sabre\DAV\INode; use Sabre\DAV\PropFind; use Sabre\DAV\Server; @@ -115,9 +118,13 @@ public function propFind(PropFind $propFind, INode $node) { // Only return the property for the parent node and ignore it for further in depth nodes $propFind->handle(self::WORKSPACE_PROPERTY, function () use ($file) { - if ($file instanceof File) { - return $file->getContent(); + try { + if ($file instanceof File) { + return $file->getContent(); + } + } catch (GenericFileException|NotPermittedException|LockedException) { } + return ''; }); $propFind->handle(self::WORKSPACE_FILE_PROPERTY, function () use ($file) {