mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Fix Unmatched checksum error (#1585)
Fixed #1575 Always consume the stream if a `data_verifier` is provided in `binstalk_download::Download` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
7f70a4e8ee
commit
01ddf00b54
1 changed files with 18 additions and 22 deletions
|
@ -201,18 +201,17 @@ impl Download<'_> {
|
|||
|
||||
debug!("Downloading and extracting then in-memory processing");
|
||||
|
||||
match extract_tar_based_stream_and_visit(&mut stream, fmt, visitor).await {
|
||||
Ok(()) => {
|
||||
debug!("Download, extraction and in-memory procession OK");
|
||||
Ok(())
|
||||
}
|
||||
Err(err) => {
|
||||
if has_data_verifier {
|
||||
consume_stream(&mut stream).await;
|
||||
}
|
||||
Err(err)
|
||||
}
|
||||
let res = extract_tar_based_stream_and_visit(&mut stream, fmt, visitor).await;
|
||||
|
||||
if has_data_verifier {
|
||||
consume_stream(&mut stream).await;
|
||||
}
|
||||
|
||||
if res.is_ok() {
|
||||
debug!("Download, extraction and in-memory procession OK");
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
/// Download a file from the provided URL and extract it to the provided path.
|
||||
|
@ -242,18 +241,15 @@ impl Download<'_> {
|
|||
PkgFmtDecomposed::Zip => extract_zip(&mut stream, path).await,
|
||||
};
|
||||
|
||||
match res {
|
||||
Ok(extracted_files) => {
|
||||
debug!("Download OK, extracted to: '{}'", path.display());
|
||||
Ok(extracted_files)
|
||||
}
|
||||
Err(err) => {
|
||||
if has_data_verifier {
|
||||
consume_stream(&mut stream).await;
|
||||
}
|
||||
Err(err)
|
||||
}
|
||||
if has_data_verifier {
|
||||
consume_stream(&mut stream).await;
|
||||
}
|
||||
|
||||
if res.is_ok() {
|
||||
debug!("Download OK, extracted to: '{}'", path.display());
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
inner(self, fmt, path.as_ref()).await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue