summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grunfink2025-06-12 10:59:26 +0200
committerGravatar grunfink2025-06-12 10:59:26 +0200
commit55213f660d0c2a14ee5b556c4422b3b9199c9355 (patch)
treee1491fc2f25c642ff4d8fcac6a01a95e36ed72e8
parentUpdated RELEASE_NOTES. (diff)
downloadsnac2-55213f660d0c2a14ee5b556c4422b3b9199c9355.tar.gz
snac2-55213f660d0c2a14ee5b556c4422b3b9199c9355.tar.xz
snac2-55213f660d0c2a14ee5b556c4422b3b9199c9355.zip
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)
1134 bst = xs_dict_set(bst, "content", ""); 1134 bst = xs_dict_set(bst, "content", "");
1135 bst = xs_dict_set(bst, "reblog", st); 1135 bst = xs_dict_set(bst, "reblog", st);
1136 1136
1137 xs *b_id = xs_toupper_i(xs_dup(xs_dict_get(st, "id")));
1138 bst = xs_dict_set(bst, "id", b_id);
1139
1137 xs_free(st); 1140 xs_free(st);
1138 st = bst; 1141 st = bst;
1139 } 1142 }
@@ -2338,15 +2341,17 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2338 /* information about a status */ 2341 /* information about a status */
2339 if (logged_in) { 2342 if (logged_in) {
2340 xs *l = xs_split(cmd, "/"); 2343 xs *l = xs_split(cmd, "/");
2341 const char *id = xs_list_get(l, 3); 2344 const char *oid = xs_list_get(l, 3);
2342 const char *op = xs_list_get(l, 4); 2345 const char *op = xs_list_get(l, 4);
2343 2346
2344 if (!xs_is_null(id)) { 2347 if (!xs_is_null(oid)) {
2345 xs *msg = NULL; 2348 xs *msg = NULL;
2346 xs *out = NULL; 2349 xs *out = NULL;
2347 2350
2348 /* skip the 'fake' part of the id */ 2351 /* skip the 'fake' part of the id */
2349 id = MID_TO_MD5(id); 2352 oid = MID_TO_MD5(oid);
2353
2354 xs *id = xs_tolower_i(xs_dup(oid));
2350 2355
2351 if (valid_status(object_get_by_md5(id, &msg))) { 2356 if (valid_status(object_get_by_md5(id, &msg))) {
2352 if (op == NULL) { 2357 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);
90xs_str *xs_strip_chars_i(xs_str *str, const char *chars); 90xs_str *xs_strip_chars_i(xs_str *str, const char *chars);
91#define xs_strip_i(str) xs_strip_chars_i(str, " \r\n\t\v\f") 91#define xs_strip_i(str) xs_strip_chars_i(str, " \r\n\t\v\f")
92xs_str *xs_tolower_i(xs_str *str); 92xs_str *xs_tolower_i(xs_str *str);
93xs_str *xs_toupper_i(xs_str *str);
93 94
94xs_list *xs_list_new(void); 95xs_list *xs_list_new(void);
95xs_list *xs_list_append_m(xs_list *list, const char *mem, int dsz); 96xs_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)
692} 693}
693 694
694 695
696xs_str *xs_toupper_i(xs_str *str)
697/* convert to lowercase */
698{
699 XS_ASSERT_TYPE(str, XSTYPE_STRING);
700
701 int n;
702
703 for (n = 0; str[n]; n++)
704 str[n] = toupper(str[n]);
705
706 return str;
707}
708
709
695/** lists **/ 710/** lists **/
696 711
697xs_list *xs_list_new(void) 712xs_list *xs_list_new(void)