commit 4bc619e

default  ·  2023-08-23 16:32:08 +0000 UTC
parent 3cc2098
mastoapi: process tag lists that are not lists correctly.
1 files changed,  +14, -3
+14, -3
 1@@ -767,11 +767,22 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
 2         xs *ml  = xs_list_new();
 3         xs *htl = xs_list_new();
 4         xs *eml = xs_list_new();
 5-        xs_list *p = xs_dict_get(msg, "tag");
 6-        xs_dict *v;
 7+        xs_list *tag = xs_dict_get(msg, "tag");
 8         int n = 0;
 9 
10-        while (xs_list_iter(&p, &v)) {
11+        xs *tag_list = NULL;
12+
13+        if (xs_type(tag) == XSTYPE_DICT) {
14+            tag_list = xs_list_new();
15+            tag_list = xs_list_append(tag_list, tag);
16+        }
17+        else
18+            tag_list = xs_dup(tag);
19+
20+        tag = tag_list;
21+        xs_dict *v;
22+
23+        while (xs_list_iter(&tag, &v)) {
24             const char *type = xs_dict_get(v, "type");
25 
26             if (xs_is_null(type))