From 74ce67a6316639974d01462a24df3fbdf9c99ae9 Mon Sep 17 00:00:00 2001 From: default Date: Mon, 5 Feb 2024 09:19:27 +0100 Subject: [PATCH] In build_mentions(), avoid adding a user handle more than once. --- html.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/html.c b/html.c index 1d46970..fca5751 100644 --- a/html.c +++ b/html.c @@ -1111,12 +1111,16 @@ xs_str *build_mentions(snac *snac, const xs_dict *msg) if (xs_list_len(l2) >= 3) { xs *s1 = xs_fmt("%s@%s ", name, xs_list_get(l2, 2)); - s = xs_str_cat(s, s1); + + if (xs_str_in(s, s1) == -1) + s = xs_str_cat(s, s1); } } else { - s = xs_str_cat(s, name); - s = xs_str_cat(s, " "); + if (xs_str_in(s, name) == -1) { + s = xs_str_cat(s, name); + s = xs_str_cat(s, " "); + } } } }