From 1fdd5d350624a7e56cd995632243333c6b4d9476 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 27 Jun 2024 16:14:44 +0200 Subject: [PATCH] perf: get folder node directly from dav node instead of getting it by id Signed-off-by: Robin Appelman --- lib/DAV/WorkspacePlugin.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/DAV/WorkspacePlugin.php b/lib/DAV/WorkspacePlugin.php index cfe965a2dd9..6f68aa8c5e1 100644 --- a/lib/DAV/WorkspacePlugin.php +++ b/lib/DAV/WorkspacePlugin.php @@ -9,7 +9,6 @@ namespace OCA\Text\DAV; use OC\Files\Node\File; -use OC\Files\Node\Folder; use OCA\DAV\Connector\Sabre\Directory; use OCA\DAV\Files\FilesHome; use OCA\Text\AppInfo\Application; @@ -77,16 +76,11 @@ public function propFind(PropFind $propFind, INode $node) { return; } - $file = null; - $owner = $this->userId ?? $node->getFileInfo()->getStorage()->getOwner(''); - $node = $this->rootFolder->getUserFolder($owner)->getFirstNodeById($node->getId()); - if ($node instanceof Folder) { - /** @var File $file */ - try { - $file = $this->workspaceService->getFile($node); - } catch (StorageNotAvailableException $e) { - // If a storage is not available we can for the propfind response assume that there is no rich workspace present - } + $node = $node->getNode(); + try { + $file = $this->workspaceService->getFile($node); + } catch (StorageNotAvailableException $e) { + $file = null; } // Only return the property for the parent node and ignore it for further in depth nodes