diff --git a/pyrogram/types/messages_and_media/photo.py b/pyrogram/types/messages_and_media/photo.py index 01337801..801d7118 100644 --- a/pyrogram/types/messages_and_media/photo.py +++ b/pyrogram/types/messages_and_media/photo.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -from typing import List +from typing import List, Optional import pyrogram from pyrogram import raw @@ -80,10 +80,13 @@ class Photo(Object): self.thumbs = thumbs @staticmethod - def _parse(client, photo: "raw.types.Photo", ttl_seconds: int = None) -> "Photo": + def _parse(client, photo: "raw.types.Photo", ttl_seconds: int = None) -> Optional["Photo"]: if isinstance(photo, raw.types.Photo): big = photo.sizes[-1] + if isinstance(big, raw.types.PhotoStrippedSize): + return None + if isinstance(big, raw.types.PhotoSizeProgressive): big = raw.types.PhotoSize( type=big.type,