From b3d87b4f7dca12e03a25395bd37d43e28aa5dddc Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Sat, 8 Aug 2026 20:10:35 +0800 Subject: [PATCH] send: fail fast when a retried local media file is gone A retried ugoira/bsky temp MP4 was already deleted with its TempDir, so the retry failed at multipart-build time with a confusing Io error and wasted all three attempts. input_file_for now rejects a missing local path up front as a clean permanent error. --- crates/xmedia-bot/src/send.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/xmedia-bot/src/send.rs b/crates/xmedia-bot/src/send.rs index 17f3dee..da8ba64 100644 --- a/crates/xmedia-bot/src/send.rs +++ b/crates/xmedia-bot/src/send.rs @@ -329,6 +329,11 @@ fn item_url(item: &MediaItemPayload) -> &str { fn input_file_for(media: &str) -> Result { if media.starts_with("http://") || media.starts_with("https://") { Ok(InputFile::url(parse_media_url(media)?)) + } else if !std::path::Path::new(media).exists() { + // A retried task may reference a temp file the original send's + // TempDir already cleaned up; fail fast and permanent instead of + // burning retries on a file that can never come back. + Err(format!("local media file missing: {media}")) } else { Ok(InputFile::file(media)) }