From a790431274f65a19392fa905a726c5b0a302c063 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 30 Jun 2019 21:08:50 +0200 Subject: [PATCH] Do string conversion and striping in the Parser --- pyrogram/client/parser/html.py | 2 +- pyrogram/client/parser/parser.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/parser/html.py b/pyrogram/client/parser/html.py index 16c5922a..04f4ad30 100644 --- a/pyrogram/client/parser/html.py +++ b/pyrogram/client/parser/html.py @@ -108,7 +108,7 @@ class HTML: self.client = client def parse(self, text: str): - text = utils.add_surrogates(str(text or "").strip()) + text = utils.add_surrogates(text) parser = Parser(self.client) parser.feed(text) diff --git a/pyrogram/client/parser/parser.py b/pyrogram/client/parser/parser.py index f685c942..cde26f0b 100644 --- a/pyrogram/client/parser/parser.py +++ b/pyrogram/client/parser/parser.py @@ -31,6 +31,8 @@ class Parser: self.markdown = Markdown(client) def parse(self, text: str, mode: str = ""): + text = str(text or "").strip() + if mode is None: return OrderedDict([ ("message", text),