diff options
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/shirabe/src/util/http/curl_downloader.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index 049b77b9..04c4753f 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -642,7 +642,13 @@ impl CurlDownloader { } Ok(match sink { - Sink::File(_) => Body::File, + Sink::File(mut f) => { + // tokio's File returns from write_all once the blocking write is queued, so the + // tail of the body can still be in flight after the loop above. flush waits for it + // and reports its error; without it the caller renames and copies a short file. + f.flush().await.map_err(|e| (e.to_string(), false))?; + Body::File + } Sink::Memory(buf) => Body::Memory(buf), }) } |
