diff options
author | Robin Appelman <robin@icewind.nl> | 2024-06-20 10:37:25 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-06-20 12:15:43 +0200 |
commit | 7a9efcf4ccf24cb015a48d58c0b0ae9149f540ac (patch) | |
tree | 062ed344d6547910323de9dd6e25b1ee32a891f4 | |
parent | 392ee62981229f762daaea4032de5f5cb6344d16 (diff) | |
download | nextcloud-server-7a9efcf4ccf24cb015a48d58c0b0ae9149f540ac.tar.gz nextcloud-server-7a9efcf4ccf24cb015a48d58c0b0ae9149f540ac.zip |
perf: remove full filesystem setup for accessing public link share dav endpoints
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/dav/appinfo/v1/publicwebdav.php | 15 | ||||
-rw-r--r-- | apps/dav/appinfo/v2/publicremote.php | 18 |
2 files changed, 15 insertions, 18 deletions
diff --git a/apps/dav/appinfo/v1/publicwebdav.php b/apps/dav/appinfo/v1/publicwebdav.php index dd4b592bd14..5ef383e1dd5 100644 --- a/apps/dav/appinfo/v1/publicwebdav.php +++ b/apps/dav/appinfo/v1/publicwebdav.php @@ -72,19 +72,20 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, funct }); \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog); - OC_Util::tearDownFS(); - OC_Util::setupFS($owner); - $ownerView = new \OC\Files\View('/'. $owner . '/files'); - $path = $ownerView->getPath($fileId); - $fileInfo = $ownerView->getFileInfo($path); - $linkCheckPlugin->setFileInfo($fileInfo); + $rootFolder = \OCP\Server::get(\OCP\Files\IRootFolder::class); + $userFolder = $rootFolder->getUserFolder($owner); + $node = $userFolder->getFirstNodeById($fileId); + if (!$node) { + throw new \Sabre\DAV\Exception\NotFound(); + } + $linkCheckPlugin->setFileInfo($node); // If not readable (files_drop) enable the filesdrop plugin if (!$isReadable) { $filesDropPlugin->enable(); } - $view = new \OC\Files\View($ownerView->getAbsolutePath($path)); + $view = new \OC\Files\View($node->getPath()); $filesDropPlugin->setView($view); return $view; 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; |