aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrunfink <grunfink@comam.es>2025-06-12 10:59:26 +0200
committergrunfink <grunfink@comam.es>2025-06-12 10:59:26 +0200
commit55213f660d0c2a14ee5b556c4422b3b9199c9355 (patch)
treee1491fc2f25c642ff4d8fcac6a01a95e36ed72e8
parent2391d2a53b42e1189151d44b5d4f7f06ec50dcf4 (diff)
mastoapi: another try to fix collapsing boosted posts in some apps.
-rw-r--r--mastoapi.c11
-rw-r--r--xs.h15
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)