1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Merge pull request #1883 from profanity-im/fix/1877-url

Cut URLs before adding to automcomp at `>`
This commit is contained in:
Michael Vetter 2023-09-05 10:44:00 +02:00 committed by GitHub
commit 394c935469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1310,7 +1310,8 @@ wins_add_urls_ac(const ProfWin* const win, const ProfMessage* const message, con
GRegex* regex;
GMatchInfo* match_info;
regex = g_regex_new("(https?|aesgcm)://\\S+", 0, 0, NULL);
// https://stackoverflow.com/questions/43588699/regex-for-matching-any-url-character
regex = g_regex_new("(https?|aesgcm)://[\\w\\-.~:/?#\\[\\]@!$&'()*+,;=%]+", 0, 0, NULL);
g_regex_match(regex, message->plain, 0, &match_info);
while (g_match_info_matches(match_info)) {