Skip to content

Commit acd92b1

Browse files
authored
Actually fix reading vectors of bare longs
1 parent c3953c1 commit acd92b1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pyrogram/raw/core/primitives/vector.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ class Vector(bytes, TLObject):
3030
# Method added to handle the special case when a query returns a bare Vector (of Ints);
3131
# i.e., RpcResult body starts with 0x1cb5c415 (Vector Id) - e.g., messages.GetMessagesViews.
3232
@staticmethod
33-
def read_bare(b: BytesIO, n: int) -> Union[int, Any]:
34-
left = len(b.read())
35-
size = left // n
36-
b.seek(-left, 1)
37-
33+
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
3834
try:
3935
return TLObject.read(b)
4036
except KeyError:
@@ -48,10 +44,13 @@ def read_bare(b: BytesIO, n: int) -> Union[int, Any]:
4844
@classmethod
4945
def read(cls, data: BytesIO, t: Any = None, *args: Any) -> List:
5046
count = Int.read(data)
47+
left = len(data.read())
48+
size = left // count
49+
data.seek(-left, 1)
5150

5251
return List(
5352
t.read(data) if t
54-
else Vector.read_bare(data, count)
53+
else Vector.read_bare(data, size)
5554
for _ in range(count)
5655
)
5756

0 commit comments

Comments
 (0)