mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-25 16:00:51 +03:00
ValueError fix for IOBase files (#1119)
This commit is contained in:
parent
df534585e9
commit
c4d65f8bf4
|
@ -649,8 +649,8 @@ def _get_extension(file):
|
||||||
kind = imghdr.what(io.BytesIO(file))
|
kind = imghdr.what(io.BytesIO(file))
|
||||||
return ('.' + kind) if kind else ''
|
return ('.' + kind) if kind else ''
|
||||||
elif isinstance(file, io.IOBase) and file.seekable():
|
elif isinstance(file, io.IOBase) and file.seekable():
|
||||||
kind = imghdr.what(file) is not None
|
kind = imghdr.what(file)
|
||||||
return ('.' + kind) if kind else ''
|
return ('.' + kind) if kind is not None else ''
|
||||||
elif getattr(file, 'name', None):
|
elif getattr(file, 'name', None):
|
||||||
# Note: ``file.name`` works for :tl:`InputFile` and some `IOBase`
|
# Note: ``file.name`` works for :tl:`InputFile` and some `IOBase`
|
||||||
return _get_extension(file.name)
|
return _get_extension(file.name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user