aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-02-09 09:54:52 +0100
committerRobin Appelman <robin@icewind.nl>2024-03-04 13:57:31 +0100
commite7a7b4a40184dc3da2c83e858c820625f660e48e (patch)
tree367bda0ac814376e7c771fbe4b1c40cf7f33df53 /lib/private/Collaboration
parent4d110c1dd6ae384c00c93b4e266118004b71e498 (diff)
downloadnextcloud-server-e7a7b4a40184dc3da2c83e858c820625f660e48e.tar.gz
nextcloud-server-e7a7b4a40184dc3da2c83e858c820625f660e48e.zip
perf: switch places that always use the first getById result to getFirstNodeById
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Collaboration')
-rw-r--r--lib/private/Collaboration/Reference/File/FileReferenceProvider.php8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php
index 5f384213976..125649246df 100644
--- a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php
+++ b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php
@@ -31,7 +31,6 @@ use OCP\Collaboration\Reference\Reference;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\InvalidPathException;
use OCP\Files\IRootFolder;
-use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IL10N;
@@ -121,15 +120,12 @@ class FileReferenceProvider extends ADiscoverableReferenceProvider {
try {
$userFolder = $this->rootFolder->getUserFolder($this->userId);
- $files = $userFolder->getById($fileId);
+ $file = $userFolder->getFirstNodeById($fileId);
- if (empty($files)) {
+ if (!$file) {
throw new NotFoundException();
}
- /** @var Node $file */
- $file = array_shift($files);
-
$reference->setTitle($file->getName());
$reference->setDescription($file->getMimetype());
$reference->setUrl($this->urlGenerator->getAbsoluteURL('/index.php/f/' . $fileId));