From 55213f660d0c2a14ee5b556c4422b3b9199c9355 Mon Sep 17 00:00:00 2001 From: grunfink Date: Thu, 12 Jun 2025 10:59:26 +0200 Subject: mastoapi: another try to fix collapsing boosted posts in some apps. --- mastoapi.c | 11 ++++++++--- xs.h | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/mastoapi.c b/mastoapi.c index 19aa610..ca44751 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1134,6 +1134,9 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg) bst = xs_dict_set(bst, "content", ""); bst = xs_dict_set(bst, "reblog", st); + xs *b_id = xs_toupper_i(xs_dup(xs_dict_get(st, "id"))); + bst = xs_dict_set(bst, "id", b_id); + xs_free(st); st = bst; } @@ -2338,15 +2341,17 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, /* information about a status */ if (logged_in) { xs *l = xs_split(cmd, "/"); - const char *id = xs_list_get(l, 3); + const char *oid = xs_list_get(l, 3); const char *op = xs_list_get(l, 4); - if (!xs_is_null(id)) { + if (!xs_is_null(oid)) { xs *msg = NULL; xs *out = NULL; /* skip the 'fake' part of the id */ - id = MID_TO_MD5(id); + oid = MID_TO_MD5(oid); + + xs *id = xs_tolower_i(xs_dup(oid)); if (valid_status(object_get_by_md5(id, &msg))) { if (op == NULL) { diff --git a/xs.h b/xs.h index ab5a264..54b913e 100644 --- a/xs.h +++ b/xs.h @@ -90,6 +90,7 @@ xs_str *xs_rstrip_chars_i(xs_str *str, const char *chars); xs_str *xs_strip_chars_i(xs_str *str, const char *chars); #define xs_strip_i(str) xs_strip_chars_i(str, " \r\n\t\v\f") xs_str *xs_tolower_i(xs_str *str); +xs_str *xs_toupper_i(xs_str *str); xs_list *xs_list_new(void); xs_list *xs_list_append_m(xs_list *list, const char *mem, int dsz); @@ -692,6 +693,20 @@ xs_str *xs_tolower_i(xs_str *str) } +xs_str *xs_toupper_i(xs_str *str) +/* convert to lowercase */ +{ + XS_ASSERT_TYPE(str, XSTYPE_STRING); + + int n; + + for (n = 0; str[n]; n++) + str[n] = toupper(str[n]); + + return str; +} + + /** lists **/ xs_list *xs_list_new(void) -- cgit v1.2.3