Seek to start before sending incidents export files

This commit is contained in:
2026-02-09 02:30:17 +03:00
parent 4f6d6dd549
commit 040a6c96e4

View File

@@ -438,6 +438,7 @@ async def incidents_export(msg: Message):
writer.writerow(row) writer.writerow(row)
bio = io.BytesIO(sio.getvalue().encode("utf-8")) bio = io.BytesIO(sio.getvalue().encode("utf-8"))
bio.name = f"incidents_{hours}h.csv" bio.name = f"incidents_{hours}h.csv"
bio.seek(0)
summary = f"📤 Incidents export ({hours}h): {len(data)} rows, format {fmt}" summary = f"📤 Incidents export ({hours}h): {len(data)} rows, format {fmt}"
await msg.answer(summary) await msg.answer(summary)
await msg.answer_document(document=InputFile(bio, filename=bio.name)) await msg.answer_document(document=InputFile(bio, filename=bio.name))