aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2024-06-24 14:43:23 +0200
committerGitHub <noreply@github.com>2024-06-24 14:43:23 +0200
commitd086f3a2bf1fcc156269e611a9c4f859eac36be8 (patch)
treec1980f8119136969de394b90f152e51b66404eb3 /apps
parentd361867e50bac77837f7d8aac881645916265d00 (diff)
parent7a9efcf4ccf24cb015a48d58c0b0ae9149f540ac (diff)
downloadnextcloud-server-d086f3a2bf1fcc156269e611a9c4f859eac36be8.tar.gz
nextcloud-server-d086f3a2bf1fcc156269e611a9c4f859eac36be8.zip
Merge pull request #45998 from nextcloud/publicdav-fs-setup
perf: remove full filesystem setup for accessing public link share dav endpoints
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/appinfo/v1/publicwebdav.php15
-rw-r--r--apps/dav/appinfo/v2/publicremote.php18
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;