mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +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))
|
||||
return ('.' + kind) if kind else ''
|
||||
elif isinstance(file, io.IOBase) and file.seekable():
|
||||
kind = imghdr.what(file) is not None
|
||||
return ('.' + kind) if kind else ''
|
||||
kind = imghdr.what(file)
|
||||
return ('.' + kind) if kind is not None else ''
|
||||
elif getattr(file, 'name', None):
|
||||
# Note: ``file.name`` works for :tl:`InputFile` and some `IOBase`
|
||||
return _get_extension(file.name)
|
||||
|
|
Loading…
Reference in New Issue
Block a user