Merge pull request #1824 from reddere/patch-3

fixing escape()
This commit is contained in:
Badiboy 2022-12-03 16:48:16 +03:00 committed by GitHub
commit 6373af78f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -399,7 +399,10 @@ def escape(text: str) -> str:
:return: the escaped text
"""
chars = {"&": "&amp;", "<": "&lt;", ">": "&gt;"}
for old, new in chars.items(): text = text.replace(old, new)
if text is None:
return None
for old, new in chars.items():
text = text.replace(old, new)
return text