From 0a6127ea6ef2f4bcc9058cfa614303e51a13bd3d Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 18 May 2021 07:01:23 +0000 Subject: [PATCH] Set maximum value --- src/Module/Api/Mastodon/Search.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index 9d7575846..bad84b2b9 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -65,12 +65,16 @@ class Search extends BaseApi // Attempt WebFinger lookup. Defaults to false. $resolve = $request['resolve']; // Maximum number of results to load, per type. Defaults to 20. Max 40. - $limit = $request['limit']; + $limit = max($request['limit'], 40); // Offset in search results. Used for pagination. Defaults to 0. $offset = $request['offset']; // Only who the user is following. Defaults to false. $following = $request['following']; + if (empty($q)) { + DI::mstdnError()->UnprocessableEntity(); + } + $result = ['accounts' => [], 'statuses' => [], 'hashtags' => []]; if (empty($type) || ($type == 'accounts')) {