Find best download source out of alternatives (format extension) (#236)

This commit is contained in:
Félix Saparelli 2022-07-24 14:32:23 +12:00 committed by GitHub
parent 19266a4fb6
commit adef01f3dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 93 additions and 52 deletions

View file

@ -32,17 +32,17 @@ impl super::Fetcher for QuickInstall {
})
}
async fn check(&self) -> Result<bool, BinstallError> {
async fn find(&self) -> Result<bool, BinstallError> {
let url = self.package_url();
self.report();
info!("Checking for package at: '{url}'");
remote_exists(&self.client, Url::parse(&url)?, Method::HEAD).await
remote_exists(self.client.clone(), Url::parse(&url)?, Method::HEAD).await
}
async fn fetch_and_extract(&self, dst: &Path) -> Result<(), BinstallError> {
let url = self.package_url();
info!("Downloading package from: '{url}'");
download_and_extract(&self.client, Url::parse(&url)?, self.pkg_fmt(), dst).await
download_and_extract(&self.client, &Url::parse(&url)?, self.pkg_fmt(), dst).await
}
fn pkg_fmt(&self) -> PkgFmt {