1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Cut URLs before adding to automcomp at >

First I tried with g_uri_parse() and g_uri_to_string() but then I
learned that GUri validation API is only for things that are part of a
proper URL.

Let's cut the string at `>` since they are sometimes enclosed in `<>`.

Fix https://github.com/profanity-im/profanity/issues/1877
This commit is contained in:
Michael Vetter 2023-08-28 12:58:00 +02:00
parent 8618203988
commit 960924d570

View File

@ -1316,6 +1316,12 @@ wins_add_urls_ac(const ProfWin* const win, const ProfMessage* const message, con
while (g_match_info_matches(match_info)) {
auto_gchar gchar* word = g_match_info_fetch(match_info, 0);
// cut string at '>' from url since they are sometimes enclosed in <>
gchar* f = g_utf8_strchr(word, -1, '>');
if (f) {
*f = '\0';
}
if (flip) {
autocomplete_add_unsorted(win->urls_ac, word, FALSE);
} else {