Do not parse PhotoStrippedSize

This commit is contained in:
Dan 2020-11-30 12:40:26 +01:00
parent 384f4eba71
commit c87177e7a6

View File

@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
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,