From aaf2b0175e1f5b78fcfaae5c6b413588f31bc9e6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 18 Jul 2026 00:48:06 +0900 Subject: fix(curl-downloader): unlink partial file on redirect-without-location failure PHP's handleRedirect() throws a bare TransportException when the Location header is missing, and the caller's single catch block always unlinks the `~` partial file via rejectJob(). The Rust decide() loop splits each failure path into its own branch and had unlinked on every other one, but missed this branch, leaking the partial file. Co-Authored-By: Claude Sonnet 5 --- crates/shirabe/src/util/http/curl_downloader.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index c0b968bd..454836e7 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -403,7 +403,12 @@ impl CurlDownloader { }); } Ok(_) => {} - Err(e) => return Ok(Decision::Failed(e)), + Err(e) => { + if let Some(filename) = filename { + unlink_silent(&format!("{}~", filename)); + } + return Ok(Decision::Failed(e)); + } } } -- cgit v1.3.1