Skip to content

Commit

Permalink
perf: get folder node directly from dav node instead of getting it by id
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Jun 27, 2024
1 parent 33bda5b commit 1fdd5d3
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/DAV/WorkspacePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1fdd5d3

Please sign in to comment.