Skip to content

Commit 8cdcf90

Browse files
committed
Enhance Parser when dealing with leading and trailing whitespaces
1 parent e1c6e6e commit 8cdcf90

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pyrogram/client/parser/html.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def handle_data(self, data):
8686

8787
for entities in self.tag_entities.values():
8888
for entity in entities:
89-
entity.length += len(data)
89+
entity.offset += len(data) - len(data.lstrip()) # Ignore left whitespaces for offsets
90+
entity.length += len(data.strip()) # Ignore all whitespaces (left + right) for lengths
9091

9192
self.text += data
9293

0 commit comments

Comments
 (0)