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 /apps/dav/lib/Controller | |
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 'apps/dav/lib/Controller')
-rw-r--r-- | apps/dav/lib/Controller/DirectController.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/apps/dav/lib/Controller/DirectController.php b/apps/dav/lib/Controller/DirectController.php index 0f618e46b22..2d4522c8d37 100644 --- a/apps/dav/lib/Controller/DirectController.php +++ b/apps/dav/lib/Controller/DirectController.php @@ -104,9 +104,9 @@ class DirectController extends OCSController { public function getUrl(int $fileId, int $expirationTime = 60 * 60 * 8): DataResponse { $userFolder = $this->rootFolder->getUserFolder($this->userId); - $files = $userFolder->getById($fileId); + $file = $userFolder->getFirstNodeById($fileId); - if ($files === []) { + if (!$file) { throw new OCSNotFoundException(); } @@ -114,7 +114,6 @@ class DirectController extends OCSController { throw new OCSBadRequestException('Expiration time should be greater than 0 and less than or equal to ' . (60 * 60 * 24)); } - $file = array_shift($files); if (!($file instanceof File)) { throw new OCSBadRequestException('Direct download only works for files'); } |