diff options
author | default <nobody@localhost> | 2024-03-25 19:58:27 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2024-03-25 19:58:27 +0100 |
commit | a453c01f323054c82d387d20446c5b66f9a85533 (patch) | |
tree | fb062e361d7210369af91bcaa063081feb57b468 /html.c | |
parent | 7d836796171d7777c0314fffd0eff31894676049 (diff) |
Some software return a list of icons instead of one, because why not.
Diffstat (limited to 'html.c')
-rw-r--r-- | html.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -113,9 +113,13 @@ xs_html *html_actor_icon(snac *user, xs_dict *actor, const char *date, xs *name = actor_name(actor); /* get the avatar */ - if ((v = xs_dict_get(actor, "icon")) != NULL && - (v = xs_dict_get(v, "url")) != NULL) { - avatar = xs_dup(v); + if ((v = xs_dict_get(actor, "icon")) != NULL) { + /* if it's a list (Peertube), get the first one */ + if (xs_type(v) == XSTYPE_LIST) + v = xs_list_get(v, 0); + + if ((v = xs_dict_get(v, "url")) != NULL) + avatar = xs_dup(v); } if (avatar == NULL) |