fix: self-heal retry rebuilds consumed File objects (no 0-byte re-upload)
send() and send_any() retry with the exact same discord.File objects after healing a dead webhook, but discord.py closes every File on the first send's exit - a buffer-backed File's retry then uploads 0 bytes silently (the buffer sits at EOF and nothing calls reset()), and a path-backed File raises "I/O operation on closed file" instead. The healed retry in both methods now routes kwargs through _rebuild_files_in_kwargs(), which rebuilds a fresh discord.File per entry in file=/files= from its original source (reopens a path-backed File, rewinds a still-seekable buffer) before the retry send. A File that can't be safely rebuilt raises ValueError rather than silently sending an empty attachment. The first, non-retry send is untouched. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "dpy_webhooks"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
description = "Per-channel Discord webhook management for discord.py — get-or-create, persist, enforce the cap, send. Config-free, injectable, installable."
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
|
||||
Reference in New Issue
Block a user