Skip to content

Commit a790431

Browse files
committed
Do string conversion and striping in the Parser
1 parent 40b0c57 commit a790431

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

pyrogram/client/parser/html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(self, client: Union["pyrogram.BaseClient", None]):
108108
self.client = client
109109

110110
def parse(self, text: str):
111-
text = utils.add_surrogates(str(text or "").strip())
111+
text = utils.add_surrogates(text)
112112

113113
parser = Parser(self.client)
114114
parser.feed(text)

pyrogram/client/parser/parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def __init__(self, client: Union["pyrogram.BaseClient", None]):
3131
self.markdown = Markdown(client)
3232

3333
def parse(self, text: str, mode: str = ""):
34+
text = str(text or "").strip()
35+
3436
if mode is None:
3537
return OrderedDict([
3638
("message", text),

0 commit comments

Comments
 (0)