Merge pull request #2009 from coder2020official/fileupload

Fixes #1944: uploading file from memory
This commit is contained in:
_run 2023-07-09 00:06:02 +05:00 committed by GitHub
commit 3960115ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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())
return json.dumps(self.to_dict())