commit bcf2670
default
·
2023-05-15 09:28:59 +0000 UTC
parent bd8886f
Made mastoapi account search case-insensitive.
1 files changed,
+10,
-5
+10,
-5
1@@ -960,9 +960,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2
3 if (logged_in && strcmp(uid, "search") == 0) { /** **/
4 /* search for accounts starting with q */
5- const char *q = xs_dict_get(args, "q");
6+ const char *aq = xs_dict_get(args, "q");
7
8- if (!xs_is_null(q)) {
9+ if (!xs_is_null(aq)) {
10+ xs *q = xs_tolower_i(xs_dup(aq));
11 out = xs_list_new();
12 xs *wing = following_list(&snac1);
13 xs *wers = follower_list(&snac1);
14@@ -986,10 +987,14 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
15 if (valid_status(object_get(v, &actor))) {
16 const char *uname = xs_dict_get(actor, "preferredUsername");
17
18- if (!xs_is_null(uname) && xs_startswith(uname, q)) {
19- xs *acct = mastoapi_account(actor);
20+ if (!xs_is_null(uname)) {
21+ xs *luname = xs_tolower_i(xs_dup(uname));
22
23- out = xs_list_append(out, acct);
24+ if (xs_startswith(luname, q)) {
25+ xs *acct = mastoapi_account(actor);
26+
27+ out = xs_list_append(out, acct);
28+ }
29 }
30 }
31 }