mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 05:04:33 +03:00
Fix inline URL matching swallowing all parse entities
This commit is contained in:
parent
f5fafc6a27
commit
bcaa8007a3
|
@ -90,6 +90,7 @@ def parse(message, delimiters=None, url_re=r'\[(.+?)\]\((.+?)\)'):
|
|||
offset = 0
|
||||
i = 0
|
||||
while i < len(message):
|
||||
url_match = None
|
||||
if current == Mode.NONE:
|
||||
url_match = url_re.match(message, pos=i)
|
||||
if url_match:
|
||||
|
@ -105,7 +106,7 @@ def parse(message, delimiters=None, url_re=r'\[(.+?)\]\((.+?)\)'):
|
|||
(Mode.URL, url_match.group(2))
|
||||
))
|
||||
i += len(url_match.group(1))
|
||||
else:
|
||||
if not url_match:
|
||||
for d, m in delimiters.items():
|
||||
if message[i:i + len(d)] == d and current in (Mode.NONE, m):
|
||||
if message[i + len(d):i + 2 * len(d)] == d:
|
||||
|
|
Loading…
Reference in New Issue
Block a user