Fix use of download_and_extract in find_crate_cratesio

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-10 15:50:56 +10:00
parent d2e688c4c2
commit fb5f61559b
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -102,16 +102,17 @@ pub async fn fetch_crate_cratesio(
debug!("Fetching crate from: {crate_url} and extracting Cargo.toml from it"); debug!("Fetching crate from: {crate_url} and extracting Cargo.toml from it");
let crate_dir = format!("{name}-{version_name}");
let crate_path = temp_dir.join(&crate_dir);
download_and_extract( download_and_extract(
Url::parse(&crate_url)?, Url::parse(&crate_url)?,
PkgFmt::Tgz, PkgFmt::Tgz,
&temp_dir, &temp_dir,
Some([Path::new("Cargo.toml").into()]), Some([Path::new(&crate_dir).join("Cargo.toml").into()]),
) )
.await?; .await?;
let crate_path = temp_dir.join(format!("{name}-{version_name}"));
// Return crate directory // Return crate directory
Ok(crate_path) Ok(crate_path)
} }