Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: remove full filesystem setup for accessing public link share dav endpoints #45998

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions apps/dav/appinfo/v1/publicwebdav.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,20 @@
});
\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;
Expand Down
18 changes: 7 additions & 11 deletions apps/dav/appinfo/v2/publicremote.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,20 @@
/** @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;
Expand Down
Loading