mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Escape text inside entity when building unparsed text (#1156)
This commit is contained in:
parent
fd2819ca7f
commit
669b39927b
@ -233,8 +233,10 @@ class HTML:
|
|||||||
while i < len(entities):
|
while i < len(entities):
|
||||||
i += recursive(i)
|
i += recursive(i)
|
||||||
|
|
||||||
|
last_offset = entities_offsets[-1][1]
|
||||||
# no need to sort, but still add entities starting from the end
|
# no need to sort, but still add entities starting from the end
|
||||||
for entity, offset in reversed(entities_offsets):
|
for entity, offset in reversed(entities_offsets):
|
||||||
text = text[:offset] + entity + text[offset:]
|
text = text[:offset] + entity + html.escape(text[offset:last_offset]) + text[last_offset:]
|
||||||
|
last_offset = offset
|
||||||
|
|
||||||
return utils.remove_surrogates(text)
|
return utils.remove_surrogates(text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user