From 7a9efcf4ccf24cb015a48d58c0b0ae9149f540ac Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 20 Jun 2024 10:37:25 +0200 Subject: perf: remove full filesystem setup for accessing public link share dav endpoints Signed-off-by: Robin Appelman --- apps/dav/appinfo/v2/publicremote.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'apps/dav/appinfo/v2') diff --git a/apps/dav/appinfo/v2/publicremote.php b/apps/dav/appinfo/v2/publicremote.php index 5f20c94c574..bdc4169dd4e 100644 --- a/apps/dav/appinfo/v2/publicremote.php +++ b/apps/dav/appinfo/v2/publicremote.php @@ -101,24 +101,20 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct /** @psalm-suppress InternalMethod */ Filesystem::logWarningWhenAddingStorageWrapper($previousLog); - OC_Util::tearDownFS(); - OC_Util::setupFS($owner); - $ownerView = new View('/'. $owner . '/files'); - $path = $ownerView->getPath($fileId); - $fileInfo = $ownerView->getFileInfo($path); - - if ($fileInfo === false) { + $rootFolder = \OCP\Server::get(\OCP\Files\IRootFolder::class); + $userFolder = $rootFolder->getUserFolder($owner); + $node = $userFolder->getFirstNodeById($fileId); + if (!$node) { throw new NotFound(); } + $linkCheckPlugin->setFileInfo($node); - $linkCheckPlugin->setFileInfo($fileInfo); - - // If not readble (files_drop) enable the filesdrop plugin + // If not readable (files_drop) enable the filesdrop plugin if (!$isReadable) { $filesDropPlugin->enable(); } - $view = new View($ownerView->getAbsolutePath($path)); + $view = new View($node->getPath()); $filesDropPlugin->setView($view); return $view; -- cgit v1.2.3