Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(raw): correctly parses bool
  • Loading branch information
HitaloM committed Feb 5, 2024
commit ac499bae277f3af1c9241d1219b86963db02971c
5 changes: 5 additions & 0 deletions hydrogram/raw/core/primitives/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from hydrogram.raw.core.list import List
from hydrogram.raw.core.tl_object import TLObject

from .bool import Bool, BoolFalse, BoolTrue
from .int import Int, Long


Expand All @@ -34,6 +35,10 @@ class Vector(bytes, TLObject):
@staticmethod
def read_bare(b: BytesIO, size: int) -> Union[int, Any]:
if size == 4:
e = int.from_bytes(b.read(4), "little")
b.seek(-4, 1)
if e in [BoolFalse.ID, BoolTrue.ID]:
Comment thread
HitaloM marked this conversation as resolved.
Outdated
return Bool.read(b)
return Int.read(b)

return Long.read(b) if size == 8 else TLObject.read(b)
Expand Down