From 9b9d86552bcab38895915b88b0da090e3aa9c4bf Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 5 Feb 2026 12:08:07 +0100 Subject: [PATCH] perf: Replace getById call with getFirstNodeById We only need the first node anyway and using getFirstNodeById is faster. Signed-off-by: Carl Schwan --- lib/Service/FilesAppService.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Service/FilesAppService.php b/lib/Service/FilesAppService.php index 931668d03..531f241f3 100644 --- a/lib/Service/FilesAppService.php +++ b/lib/Service/FilesAppService.php @@ -140,11 +140,10 @@ public function getAttachmentCount(int $cardId): int { public function extendData(Attachment $attachment) { $userFolder = $this->rootFolder->getUserFolder($this->userId); $share = $this->getShareForAttachment($attachment); - $files = $userFolder->getById($share->getNode()->getId()); - if (count($files) === 0) { + $file = $userFolder->getFirstNodeById($share->getNode()->getId()); + if ($file === null) { return $attachment; } - $file = array_shift($files); $attachment->setExtendedData([ 'path' => $userFolder->getRelativePath($file->getPath()), 'fileid' => $file->getId(),