commit a453c01

default  ·  2024-03-25 18:58:27 +0000 UTC
parent 7d83679
Some software return a list of icons instead of one, because why not.
1 files changed,  +7, -3
M html.c
M html.c
+7, -3
 1@@ -113,9 +113,13 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date,
 2     xs *name = actor_name(actor);
 3 
 4     /* get the avatar */
 5-    if ((v = xs_dict_get(actor, "icon")) != NULL &&
 6-        (v = xs_dict_get(v, "url")) != NULL) {
 7-        avatar = xs_dup(v);
 8+    if ((v = xs_dict_get(actor, "icon")) != NULL) {
 9+        /* if it's a list (Peertube), get the first one */
10+        if (xs_type(v) == XSTYPE_LIST)
11+            v = xs_list_get(v, 0);
12+
13+        if ((v = xs_dict_get(v, "url")) != NULL)
14+            avatar = xs_dup(v);
15     }
16 
17     if (avatar == NULL)