Просмотр исходного кода

Some software return a list of icons instead of one, because why not.

default 2 лет назад
Родитель
Сommit
a453c01f32
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      html.c

+ 7 - 3
html.c

@@ -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)