fix jar files downloading incorrectly

This commit is contained in:
LordMZTE 2021-09-01 15:55:31 +02:00
parent 3de0fc53b9
commit 8939d1195d

View file

@ -66,11 +66,16 @@ impl<C: Callback> Downloader<C> {
let res = client.get(url.clone()).send().await?;
let status = res.status();
let mut stream = res.bytes_stream();
// this doesn't work for downloading jar files
if let Some(b) = stream.next().await {
file.write_all_buf(&mut b?).await?;
}
// let mut stream = res.bytes_stream();
// if let Some(b) = stream.next().await {
// file.write_all_buf(&mut b?).await?;
//}
let body = res.bytes().await?;
file.write_all(&body).await?;
Ok(DownloadInfo {
from: url,