mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-09-21 19:32:39 +03:00
Correct handling of trailing zeros in _rle_encode (#4702)
This commit is contained in:
parent
859a83a1a5
commit
82a24d6b53
|
@ -1095,6 +1095,8 @@ def _rle_encode(string):
|
|||
count = 0
|
||||
|
||||
new += bytes([cur])
|
||||
if count != 0:
|
||||
new += b'\0' + bytes([count])
|
||||
return new
|
||||
|
||||
|
||||
|
|
|
@ -52,3 +52,7 @@ def test_private_get_extension():
|
|||
assert utils._get_extension(empty_buffer) == ''
|
||||
assert utils._get_extension(empty_buffer) == '' # make sure it did seek back
|
||||
assert utils._get_extension(CustomFd('foo')) == ''
|
||||
|
||||
|
||||
def test_rle_encode_trailing_zeros():
|
||||
assert utils._rle_encode(b'\x12\x00\x00\x00\x00') == b'\x12\x00\x04'
|
||||
|
|
Loading…
Reference in New Issue
Block a user