summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-08-23 18:32:08 +0200
committerdefault <nobody@localhost>2023-08-23 18:32:08 +0200
commit4bc619e2fc4f949cea8b281c0a4da369dae5fa01 (patch)
tree3fc518e9b1db928427e20135c6e9dd9aaaffff14 /mastoapi.c
parent3cc2098023c447906445b82eebaa7f4cdfcd33be (diff)
mastoapi: process tag lists that are not lists correctly.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 48f32b7..9b3d68f 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -767,11 +767,22 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
xs *ml = xs_list_new();
xs *htl = xs_list_new();
xs *eml = xs_list_new();
- xs_list *p = xs_dict_get(msg, "tag");
- xs_dict *v;
+ xs_list *tag = xs_dict_get(msg, "tag");
int n = 0;
- while (xs_list_iter(&p, &v)) {
+ xs *tag_list = NULL;
+
+ if (xs_type(tag) == XSTYPE_DICT) {
+ tag_list = xs_list_new();
+ tag_list = xs_list_append(tag_list, tag);
+ }
+ else
+ tag_list = xs_dup(tag);
+
+ tag = tag_list;
+ xs_dict *v;
+
+ while (xs_list_iter(&tag, &v)) {
const char *type = xs_dict_get(v, "type");
if (xs_is_null(type))