mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-22 15:17:00 +01:00
Add ability to set custom filename (fix InputFile class)
For commands that uses InputFile class
This commit is contained in:
parent
714adc13ee
commit
4a761d0611
1 changed files with 4 additions and 1 deletions
|
@ -67,7 +67,10 @@ class InputFile(object):
|
|||
|
||||
if isinstance(self.input_file, file):
|
||||
self.input_file_content = self.input_file.read()
|
||||
self.filename = os.path.basename(self.input_file.name)
|
||||
if self.data.has_key('filename') and self.data['filename']:
|
||||
self.filename = self.data['filename']
|
||||
else:
|
||||
self.filename = os.path.basename(self.input_file.name)
|
||||
self.mimetype = mimetypes.guess_type(self.filename)[0] or \
|
||||
DEFAULT_MIME_TYPE
|
||||
|
||||
|
|
Loading…
Reference in a new issue