Skip to content

Commit

Permalink
Merge pull request #27303 from nextcloud/backport/27062/stable21
Browse files Browse the repository at this point in the history
[stable21] properly use limit and offset for search in Jail wrapper
  • Loading branch information
juliusknorr authored Jun 9, 2021
2 parents 3708360 + a21eb8d commit 6e190b1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/private/Files/Cache/Wrapper/CacheJail.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,9 @@ public function searchQuery(ISearchQuery $query) {
ISearchBinaryOperator::OPERATOR_AND,
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [$prefixFilter, $rootFilter]) , $query->getSearchOperation()]
);
$simpleQuery = new SearchQuery($operation, 0, 0, $query->getOrder(), $query->getUser());
$simpleQuery = new SearchQuery($operation, $query->getLimit(), $query->getOffset(), $query->getOrder(), $query->getUser());
$results = $this->getCache()->searchQuery($simpleQuery);
$results = $this->formatSearchResults($results);

$limit = $query->getLimit() === 0 ? null : $query->getLimit();
$results = array_slice($results, $query->getOffset(), $limit);

return $results;
return $this->formatSearchResults($results);
}

/**
Expand Down

0 comments on commit 6e190b1

Please sign in to comment.