From 08a11eeacfe30d567b8923613d93697e84903d4b Mon Sep 17 00:00:00 2001 From: Julian Haupt Date: Sun, 9 May 2021 15:33:01 +0200 Subject: [PATCH 1/3] Fix get_sender when using it on a ChannelForbidden (#3053) Closes #3051. --- telethon/tl/custom/sendergetter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/tl/custom/sendergetter.py b/telethon/tl/custom/sendergetter.py index f0fa4168..673cab25 100644 --- a/telethon/tl/custom/sendergetter.py +++ b/telethon/tl/custom/sendergetter.py @@ -44,7 +44,7 @@ class SenderGetter(abc.ABC): # in which case we want to force fetch the entire thing because # the user explicitly called a method. If the user is okay with # cached information, they may use the property instead. - if (self._sender is None or self._sender.min) \ + if (self._sender is None or getattr(self._sender, 'min', None)) \ and await self.get_input_sender(): try: self._sender =\ From d44928c27b4a34e396414a79966726c8877c023b Mon Sep 17 00:00:00 2001 From: Anonymous <69723581+New-dev0@users.noreply.github.com> Date: Sun, 9 May 2021 19:03:28 +0530 Subject: [PATCH 2/3] Change outdated reference to archive with edit_folder (#3052) --- telethon/client/dialogs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/client/dialogs.py b/telethon/client/dialogs.py index 44e57c34..3665c94e 100644 --- a/telethon/client/dialogs.py +++ b/telethon/client/dialogs.py @@ -370,7 +370,7 @@ class DialogMethods: await client.edit_folder(dialogs, [0, 1]) # Un-archiving all dialogs - await client.archive(unpack=1) + await client.edit_folder(unpack=1) """ if (entity is None) == (unpack is None): raise ValueError('You can only set either entities or unpack, not both') From f6a0f5f979a8ea58ea22f7f8d7c95a85d4dfc5a0 Mon Sep 17 00:00:00 2001 From: blank X Date: Fri, 14 May 2021 06:11:54 +0000 Subject: [PATCH 3/3] Make offset divisible by limit (#3042) --- telethon/client/downloads.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index f76129ee..1bce3062 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -142,12 +142,12 @@ class _DirectDownloadIter(RequestIter): class _GenericDownloadIter(_DirectDownloadIter): - async def _load_next_chunk(self, mask=MIN_CHUNK_SIZE - 1): + async def _load_next_chunk(self): # 1. Fetch enough for one chunk data = b'' # 1.1. ``bad`` is how much into the data we have we need to offset - bad = self.request.offset & mask + bad = self.request.offset % self.request.limit before = self.request.offset # 1.2. We have to fetch from a valid offset, so remove that bad part @@ -702,7 +702,8 @@ class DownloadMethods: if chunk_size == request_size \ and offset % MIN_CHUNK_SIZE == 0 \ - and stride % MIN_CHUNK_SIZE == 0: + and stride % MIN_CHUNK_SIZE == 0 \ + and offset % limit == 0: cls = _DirectDownloadIter self._log[__name__].info('Starting direct file download in chunks of ' '%d at %d, stride %d', request_size, offset, stride)