]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: obey offset and limit for results from favs and circles
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 21 Jun 2023 18:04:35 +0000 (20:04 +0200)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Wed, 21 Jun 2023 18:28:01 +0000 (20:28 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
apps/dav/lib/Connector/Sabre/FilesReportPlugin.php

index 450fe1347725dce8d54362c2f22e849de9cf53f4..a828f873086e0485f30306d68a339221d822fc0d 100644 (file)
@@ -219,6 +219,10 @@ class FilesReportPlugin extends ServerPlugin {
                // gather all file ids matching filter
                try {
                        $resultFileIds = $this->processFilterRulesForFileIDs($filterRules);
+                       // no logic in circles and favorites for paging, we always have all results, and slice later on
+                       $resultFileIds = array_slice($resultFileIds, $offset ?? 0, $limit ?? null);
+                       // fetching nodes has paging on DB level – therefore we cannot mix and slice the results, similar
+                       // to user backends. I.e. the final result may return more results than requested.
                        $resultNodes = $this->processFilterRulesForFileNodes($filterRules, $limit ?? null, $offset ?? null);
                } catch (TagNotFoundException $e) {
                        throw new PreconditionFailed('Cannot filter by non-existing tag', 0, $e);