From ac8790c3cd1dae815e276de000a5b31a437be7e8 Mon Sep 17 00:00:00 2001 From: default Date: Fri, 22 Sep 2023 12:34:47 +0200 Subject: [PATCH] If a metadata starts with https:, convert it to a link. --- activitypub.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/activitypub.c b/activitypub.c index 6770039..a8a570c 100644 --- a/activitypub.c +++ b/activitypub.c @@ -982,9 +982,19 @@ xs_dict *msg_actor(snac *snac) while (xs_dict_iter(&metadata, &k, &v)) { xs *d = xs_dict_new(); + xs *k2 = encode_html(k); + xs *v2 = NULL; + + if (xs_startswith(v, "https:")) { + xs *t = encode_html(v); + v2 = xs_fmt("%s", t, t); + } + else + v2 = encode_html(v); + d = xs_dict_append(d, "type", "PropertyValue"); - d = xs_dict_append(d, "name", k); - d = xs_dict_append(d, "value", v); + d = xs_dict_append(d, "name", k2); + d = xs_dict_append(d, "value", v2); attach = xs_list_append(attach, d); }