mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Handle invalid upload of text fd more gracefully
This commit is contained in:
@@ -500,6 +500,11 @@ class UploadMethods:
|
||||
if pos is not None:
|
||||
file.seek(pos)
|
||||
|
||||
if not isinstance(data, bytes):
|
||||
raise TypeError(
|
||||
'file descriptor returned {}, not bytes (you must '
|
||||
'open the file in bytes mode)'.format(type(data)))
|
||||
|
||||
file = data
|
||||
file_size = len(file)
|
||||
|
||||
|
Reference in New Issue
Block a user