diff options
author | Robin Appelman <robin@icewind.nl> | 2024-02-09 09:54:52 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2024-03-04 13:57:31 +0100 |
commit | e7a7b4a40184dc3da2c83e858c820625f660e48e (patch) | |
tree | 367bda0ac814376e7c771fbe4b1c40cf7f33df53 /core/Controller/PreviewController.php | |
parent | 4d110c1dd6ae384c00c93b4e266118004b71e498 (diff) | |
download | nextcloud-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 'core/Controller/PreviewController.php')
-rw-r--r-- | core/Controller/PreviewController.php | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index 34c21bd3ecb..7ab22dceaa2 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -133,14 +133,12 @@ class PreviewController extends Controller { } $userFolder = $this->root->getUserFolder($this->userId); - $nodes = $userFolder->getById($fileId); + $node = $userFolder->getFirstNodeById($fileId); - if (\count($nodes) === 0) { + if (!$node) { return new DataResponse([], Http::STATUS_NOT_FOUND); } - $node = array_pop($nodes); - return $this->fetchPreview($node, $x, $y, $a, $forceIcon, $mode, $mimeFallback); } |