From 00b95466f53d98dbd6a876de0cdf4d08bd81b063 Mon Sep 17 00:00:00 2001 From: Oleg A Date: Sat, 30 Nov 2019 03:59:33 +0300 Subject: [PATCH] #227 Rewind Bytes in InputFile before send --- aiogram/bot/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aiogram/bot/api.py b/aiogram/bot/api.py index 675626ac..8aa26d16 100644 --- a/aiogram/bot/api.py +++ b/aiogram/bot/api.py @@ -138,6 +138,10 @@ def compose_data(params=None, files=None): else: filename, fileobj = guess_filename(f) or key, f + # rewind to start of the file + if hasattr(fileobj, 'seekable') and fileobj.seekable(): + fileobj.seek(0) + data.add_field(key, fileobj, filename=filename) return data