mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-15 19:10:57 +03:00
Stop treating image/webp as images as Telegram throws error
This commit is contained in:
parent
e088fc3a4e
commit
70ef93a62e
|
@ -55,9 +55,6 @@ def get_display_name(entity):
|
||||||
|
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
# For some reason, .webp (stickers' format) is not registered
|
|
||||||
add_type('image/webp', '.webp')
|
|
||||||
|
|
||||||
|
|
||||||
def get_extension(media):
|
def get_extension(media):
|
||||||
"""Gets the corresponding extension for any Telegram media"""
|
"""Gets the corresponding extension for any Telegram media"""
|
||||||
|
@ -319,8 +316,10 @@ def get_input_media(media, is_photo=False):
|
||||||
|
|
||||||
def is_image(file):
|
def is_image(file):
|
||||||
"""Returns True if the file extension looks like an image file"""
|
"""Returns True if the file extension looks like an image file"""
|
||||||
return (isinstance(file, str) and
|
if not isinstance(file, str):
|
||||||
(mimetypes.guess_type(file)[0] or '').startswith('image/'))
|
return False
|
||||||
|
mime = mimetypes.guess_type(file)[0] or ''
|
||||||
|
return mime.startswith('image/') and not mime.endswith('/webp')
|
||||||
|
|
||||||
|
|
||||||
def is_audio(file):
|
def is_audio(file):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user