fix(rpc): fix search arg check

When by == 'maintainer', we allow an unspecified keyword,
resulting in a search of orphan packages. Fix our search
check so that when no arg is given, it is set to an empty
str().

We already check for valid args when type is not maintainer,
so there's no need to worry about other args falling through.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-30 22:53:30 -07:00
parent af2f3694e7
commit 9fef8b0611
No known key found for this signature in database
GPG key ID: F7E46DED420788F3

View file

@ -200,8 +200,8 @@ class RPC:
if by != "m" and not len(args): if by != "m" and not len(args):
raise RPCError("No request type/data specified.") raise RPCError("No request type/data specified.")
arg = args[0] arg = args[0] if args else str()
if len(arg) < 2: if by != "m" and len(arg) < 2:
raise RPCError("Query arg too small.") raise RPCError("Query arg too small.")
search = RPCSearch() search = RPCSearch()