summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2024-05-16 10:10:54 +0200
committerGitHub <noreply@github.com>2024-05-16 10:10:54 +0200
commit5574a2b26881dfa26f9fcd3232099085a63c8e3c (patch)
tree0503b3606a91abbb3b3cc93eeb023bbec027bde5
parentf8169579ad24ad95aacbb10fe6d820b5002ea3cb (diff)
parent90c5b1273c23d2baea66f4d1b9e4acb40b001d79 (diff)
downloadnextcloud-server-5574a2b26881dfa26f9fcd3232099085a63c8e3c.tar.gz
nextcloud-server-5574a2b26881dfa26f9fcd3232099085a63c8e3c.zip
Merge pull request #45320 from nextcloud/backport/45317/stable27
[stable27] fix(search): Limit maximum number of search results
-rw-r--r--core/Controller/UnifiedSearchController.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php
index 62fbc5dcccf..925546c305d 100644
--- a/core/Controller/UnifiedSearchController.php
+++ b/core/Controller/UnifiedSearchController.php
@@ -97,6 +97,9 @@ class UnifiedSearchController extends OCSController {
}
[$route, $routeParameters] = $this->getRouteInformation($from);
+ $limit ??= SearchQuery::LIMIT_DEFAULT;
+ $limit = max(1, min($limit, 25));
+
return new DataResponse(
$this->composer->search(
$this->userSession->getUser(),
@@ -104,7 +107,7 @@ class UnifiedSearchController extends OCSController {
new SearchQuery(
$term,
$sortOrder ?? ISearchQuery::SORT_DATE_DESC,
- $limit ?? SearchQuery::LIMIT_DEFAULT,
+ $limit,
$cursor,
$route,
$routeParameters