mirror of
https://github.com/zedeus/nitter.git
synced 2024-06-09 08:39:22 +00:00
Fix invalid user search errors again
This commit is contained in:
parent
376b444500
commit
2f3ee727a3
|
@ -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
|
||||
|
|
|
@ -27,7 +27,11 @@ proc createSearchRouter*(cfg: Config) =
|
|||
of users:
|
||||
if "," in q:
|
||||
redirect("/" & q)
|
||||
let users = await getUserSearch(query, getCursor())
|
||||
var users: Result[User]
|
||||
try:
|
||||
users = await getUserSearch(query, getCursor())
|
||||
except InternalError:
|
||||
users = Result[User](beginning: true, query: query)
|
||||
resp renderMain(renderUserSearch(users, prefs), request, cfg, prefs, title)
|
||||
of tweets:
|
||||
let
|
||||
|
|
|
@ -45,9 +45,10 @@ type
|
|||
null = 0
|
||||
noUserMatches = 17
|
||||
protectedUser = 22
|
||||
paramsMissing = 25
|
||||
missingParams = 25
|
||||
couldntAuth = 32
|
||||
doesntExist = 34
|
||||
invalidParam = 47
|
||||
userNotFound = 50
|
||||
suspended = 63
|
||||
rateLimited = 88
|
||||
|
|
Loading…
Reference in a new issue