commit 7f10057cff51748f7fb96021dc755127991cdbf9
parent 251d31e10e7ab70d9480b2e056d1d76260de7046
Author: green <dandelions@disroot.org>
Date: Sat, 22 Mar 2025 21:31:01 +0100
fixed broken emojis on akkoma
Diffstat:
M | html.c | | | 18 | ++++++++++++++++-- |
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/html.c b/html.c
@@ -91,8 +91,18 @@ xs_str *replace_shortnames(xs_str *s, const xs_list *tag, int ems, const char *p
const char *u = xs_dict_get(i, "url");
const char *mt = xs_dict_get(i, "mediaType");
- if (xs_is_string(u) && xs_is_string(mt)) {
- if (strcmp(mt, "image/svg+xml") == 0 && !xs_is_true(xs_dict_get(srv_config, "enable_svg")))
+ if (xs_is_string(u)) {
+ // on akkoma instances mediaType is not present.
+ // but we need to to know if the image is an svg or not.
+ // for now, i just use the file extention, which may not be the most reliable...
+ int is_svg = 0;
+ if (xs_is_string(mt)) {
+ is_svg = (strcmp(mt, "image/svg+xml") == 0);
+ } else {
+ is_svg = xs_endswith(u, ".svg");
+ }
+
+ if (is_svg && !xs_is_true(xs_dict_get(srv_config, "enable_svg")))
s = xs_replace_i(s, n, "");
else {
xs *url = make_url(u, proxy, 0);
@@ -3112,6 +3122,10 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
if (!xs_is_null(c)) {
xs *sc = sanitize(c);
+
+ // replace shortnames in bio
+ // bug: this somehow fires twice on one specific user
+ // @ielenia@ck.catwithaclari.net
sc = replace_shortnames(sc, xs_dict_get(actor, "tag"), 2, proxy);
xs_html *snac_content = xs_html_tag("div",