Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions core/Controller/UnifiedSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getProviders(string $from = ''): DataResponse {
* @param string $providerId ID of the provider
* @param string $term Term to search
* @param int|null $sortOrder Order of entries
* @param int|null $limit Maximum amount of entries
* @param int|null $limit Maximum amount of entries, limited to 25
* @param int|string|null $cursor Offset for searching
* @param string $from The current user URL
*
Expand All @@ -113,6 +113,9 @@ public function search(
): DataResponse {
[$route, $routeParameters] = $this->getRouteInformation($from);

$limit ??= SearchQuery::LIMIT_DEFAULT;
$limit = max(1, min($limit, 25));

try {
$filters = $this->composer->buildFilterList($providerId, $this->request->getParams());
} catch (UnsupportedFilter|InvalidArgumentException $e) {
Expand All @@ -125,7 +128,7 @@ public function search(
new SearchQuery(
$filters,
$sortOrder ?? ISearchQuery::SORT_DATE_DESC,
$limit ?? SearchQuery::LIMIT_DEFAULT,
$limit,
$cursor,
$route,
$routeParameters
Expand Down
2 changes: 1 addition & 1 deletion core/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5366,7 +5366,7 @@
{
"name": "limit",
"in": "query",
"description": "Maximum amount of entries",
"description": "Maximum amount of entries, limited to 25",
"schema": {
"type": "integer",
"format": "int64",
Expand Down