diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-18 00:48:06 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-18 00:48:06 +0900 |
| commit | aaf2b0175e1f5b78fcfaae5c6b413588f31bc9e6 (patch) | |
| tree | 8f1b5f6eef24939d03e4fe5808f828b790813652 /crates/shirabe/src/util/http | |
| parent | ccef521aa73e724d25c40e60ec3c08f2b0863e3b (diff) | |
| download | php-shirabe-aaf2b0175e1f5b78fcfaae5c6b413588f31bc9e6.tar.gz php-shirabe-aaf2b0175e1f5b78fcfaae5c6b413588f31bc9e6.tar.zst php-shirabe-aaf2b0175e1f5b78fcfaae5c6b413588f31bc9e6.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/http')
| -rw-r--r-- | crates/shirabe/src/util/http/curl_downloader.rs | 7 |
1 files changed, 6 insertions, 1 deletions
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)); + } } } |
