snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit e2bb8078641f810b019635dd41f3e7ea191c5b52
parent 9f8cd38ee72d93dec626b1e926f969cb75fd3094
Author: grunfink <grunfink@comam.es>
Date:   Wed, 28 May 2025 08:45:44 +0200

Don't prepend a # before a hashtag that is really an URL.

Diffstat:
Mhtml.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/html.c b/html.c @@ -4956,9 +4956,16 @@ int html_post_handler(const xs_dict *req, const char *q_path, if (*s1 == '\0') continue; - xs *s2 = xs_utf8_to_lower(s1); - if (*s2 != '#') - s2 = xs_str_prepend_i(s2, "#"); + xs *s2 = NULL; + + if (xs_startswith(s1, "https:/")) + s2 = xs_dup(s1); + else { + s2 = xs_utf8_to_lower(s1); + + if (*s2 != '#') + s2 = xs_str_prepend_i(s2, "#"); + } new_hashtags = xs_list_append(new_hashtags, s2); }