From 916569cdc5c51567ba7fd104f400ee5b8933cc1b Mon Sep 17 00:00:00 2001 From: _run Date: Sat, 8 Jul 2023 23:42:47 +0500 Subject: [PATCH] Fixes #1944: uploading file from memory --- telebot/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index b793073..7f5fc30 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -7250,7 +7250,7 @@ class InputFile: _file = open(file, 'rb') return _file, os.path.basename(_file.name) elif isinstance(file, IOBase): - return file, os.path.basename(file.name) + return file, service_utils.generate_random_token() elif isinstance(file, Path): _file = open(file, 'rb') return _file, os.path.basename(_file.name) @@ -7742,4 +7742,4 @@ class InlineQueryResultsButton(JsonSerializable, Dictionaryable): return json_dict def to_json(self) -> str: - return json.dumps(self.to_dict()) \ No newline at end of file + return json.dumps(self.to_dict())