From 92b3ca2888f1ec4eff1050b327aca33d18bf9ca2 Mon Sep 17 00:00:00 2001 From: Zed Date: Fri, 21 Apr 2023 13:06:26 +0200 Subject: [PATCH] Fix invalid user search errors again --- src/experimental/parser/user.nim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/experimental/parser/user.nim b/src/experimental/parser/user.nim index a956aa85d..b4d710f6c 100644 --- a/src/experimental/parser/user.nim +++ b/src/experimental/parser/user.nim @@ -80,6 +80,8 @@ proc parseUser*(json: string; username=""): User = proc parseUsers*(json: string; after=""): Result[User] = result = Result[User](beginning: after.len == 0) - let raw = json.fromJson(seq[RawUser]) - for user in raw: - result.content.add user.toUser + # starting with '{' means it's an error + if json[0] == '[': + let raw = json.fromJson(seq[RawUser]) + for user in raw: + result.content.add user.toUser