mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-26 01:03:37 +00:00
If a metadata starts with https:, convert it to a link.
This commit is contained in:
parent
5278e89142
commit
ac8790c3cd
1 changed files with 12 additions and 2 deletions
|
@ -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("<a href=\"%s\">%s</a>", 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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue