commit e2bb807

grunfink  ·  2025-05-28 06:45:44 +0000 UTC
parent 9f8cd38
Don't prepend a # before a hashtag that is really an URL.
1 files changed,  +10, -3
M html.c
M html.c
+10, -3
 1@@ -4956,9 +4956,16 @@ int html_post_handler(const xs_dict *req, const char *q_path,
 2                 if (*s1 == '\0')
 3                     continue;
 4 
 5-                xs *s2 = xs_utf8_to_lower(s1);
 6-                if (*s2 != '#')
 7-                    s2 = xs_str_prepend_i(s2, "#");
 8+                xs *s2 = NULL;
 9+
10+                if (xs_startswith(s1, "https:/"))
11+                    s2 = xs_dup(s1);
12+                else {
13+                    s2 = xs_utf8_to_lower(s1);
14+
15+                    if (*s2 != '#')
16+                        s2 = xs_str_prepend_i(s2, "#");
17+                }
18 
19                 new_hashtags = xs_list_append(new_hashtags, s2);
20             }