commit ac8790c
default
·
2023-09-22 10:34:47 +0000 UTC
parent 5278e89
If a metadata starts with https:, convert it to a link.
1 files changed,
+12,
-2
+12,
-2
1@@ -982,9 +982,19 @@ xs_dict *msg_actor(snac *snac)
2 while (xs_dict_iter(&metadata, &k, &v)) {
3 xs *d = xs_dict_new();
4
5+ xs *k2 = encode_html(k);
6+ xs *v2 = NULL;
7+
8+ if (xs_startswith(v, "https:")) {
9+ xs *t = encode_html(v);
10+ v2 = xs_fmt("<a href=\"%s\">%s</a>", t, t);
11+ }
12+ else
13+ v2 = encode_html(v);
14+
15 d = xs_dict_append(d, "type", "PropertyValue");
16- d = xs_dict_append(d, "name", k);
17- d = xs_dict_append(d, "value", v);
18+ d = xs_dict_append(d, "name", k2);
19+ d = xs_dict_append(d, "value", v2);
20
21 attach = xs_list_append(attach, d);
22 }