URL detection: Allow trailing asterisks in URLs

Fixes #9543
This commit is contained in:
Kovid Goyal 2026-02-23 07:54:47 +05:30
parent 1df89d9448
commit 8df80afa79
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 1 deletions

View file

@ -238,6 +238,8 @@ Detailed list of changes
- macOS: Workaround for yet another Tahoe bug causing rendering to fail
(:pull:`9520`)
- URL detection: Allow trailing asterisks in URLs (:iss:`9543`)
0.45.0 [2025-12-24]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -58,7 +58,9 @@ is_url_char(uint32_t ch) {
static inline bool
can_strip_from_end_of_url(uint32_t ch) {
// remove trailing punctuation
return (char_props_for(ch).is_punctuation && ch != '/' && ch != '&' && ch != '-' && ch != ')' && ch != ']' && ch != '}');
return (char_props_for(ch).is_punctuation &&
ch != '/' && ch != '&' && ch != '-' && ch != ')' && ch != ']' && ch != '}' && ch != '*'
);
}
static inline bool

View file

@ -1711,3 +1711,4 @@ def t(url, x=0, y=0, before='', after='', expected=''):
t('http://[::1]:8080/x', after='[') # ]
t('http://[::1]:8080/x]y34', expected='http://[::1]:8080/x')
t('https://wraps-by-one-char.com[]/x', after='[') # ]
t('https://t.me/#1_*_*_*_*')