Replies: 7 comments 1 reply
-
Wat about passing chat_id?... |
Beta Was this translation helpful? Give feedback.
-
My working code:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the quick response, chat_id is passed in kwargs, everything is fine there. The problem seems to be only in the asynchronous version of the bot. python3.12/site-packages/aiohttp/formdata.py", line 159, in _gen_form_data My test code:
|
Beta Was this translation helpful? Give feedback.
-
For me, probably the most expected behavior is the correct handling of the file name in BytesIO. For now, I have made a patch on the class InputFile and send it without the visible_file_name parameter, and it works well. As soon as I add visible_file_name, it still has the problems described above. Most likely, aiohttp receives InputFile in the payload, but expects some kind of byte object, and since it does not know how to process InputFile, it fails. types.py
|
Beta Was this translation helpful? Give feedback.
-
I have received your bug report and will investigate this issue soon |
Beta Was this translation helpful? Give feedback.
-
Can confirm that using InputFile for BytesIO files causes a random file name to be generated. file_input = InputFile(io.BytesIO(downloaded_file))
file_input.file_name = 'new_file_name.png'
await bot.send_document(message.chat.id, file_input) |
Beta Was this translation helpful? Give feedback.
-
Also, sync seems to be handling this differently: file name is totally ignored |
Beta Was this translation helpful? Give feedback.
-
Please answer these questions before submitting your issue. Thanks!
4.20.0
Ubuntu
python3.12
I am trying to send files and specify the file name, here is my attempt:
Beta Was this translation helpful? Give feedback.
All reactions