summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-02-26 20:23:02 +0100
committerdefault <nobody@localhost>2023-02-26 20:23:02 +0100
commitec48ec314f9cd1ae3ecd4f8ca2d9c32665bdf8bd (patch)
treef49cd4f7a08f990bc705588a9d59a5a4f807f608
parent91d670a627b536e818eb00f289a049bf0f102040 (diff)
Don't inline empty avatars in og:avatar meta property.
-rw-r--r--html.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/html.c b/html.c
index f969440..48672dd 100644
--- a/html.c
+++ b/html.c
@@ -226,6 +226,14 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
s_bio[n] = '\0';
+ xs *s_avatar = xs_dup(avatar);
+
+ /* don't inline an empty avatar: create a real link */
+ if (xs_startswith(s_avatar, "data:")) {
+ xs_free(s_avatar);
+ s_avatar = xs_fmt("%s/susie.png", srv_baseurl);
+ }
+
/* og properties */
xs *s1 = xs_fmt(
"<meta property=\"og:site_name\" content=\"%s\"/>\n"
@@ -239,7 +247,7 @@ d_char *html_user_header(snac *snac, d_char *s, int local)
snac->uid,
xs_dict_get(srv_config, "host"),
s_bio,
- avatar);
+ s_avatar);
s = xs_str_cat(s, s1);
}