From d67ed42edc15d02052648679e8d2f032a633cafc Mon Sep 17 00:00:00 2001 From: Luca Angemi Date: Sun, 2 Jun 2024 08:32:24 +0200 Subject: [PATCH] Fix telegram bot send_document (#118616) --- homeassistant/components/telegram_bot/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py index df5bebb47d4..06c15da5f70 100644 --- a/homeassistant/components/telegram_bot/__init__.py +++ b/homeassistant/components/telegram_bot/__init__.py @@ -287,7 +287,9 @@ SERVICE_MAP = { def _read_file_as_bytesio(file_path: str) -> io.BytesIO: """Read a file and return it as a BytesIO object.""" with open(file_path, "rb") as file: - return io.BytesIO(file.read()) + data = io.BytesIO(file.read()) + data.name = file_path + return data async def load_data(