diff --git a/src/package_info.rs b/src/package_info.rs index 432b12d..e31bfa9 100644 --- a/src/package_info.rs +++ b/src/package_info.rs @@ -20,15 +20,15 @@ pub fn ppa_to_base_url(user: &str, name: &str) -> String { async fn check_launchpad_repo(package: &str) -> Result, Box> { let url = format!("https://git.launchpad.net/ubuntu/+source/{}", package); - let client = reqwest::Client::builder() - .redirect(reqwest::redirect::Policy::none()) - .build()?; - let response = client.head(&url).send().await?; - if response.status().is_success() { - Ok(Some(url)) - } else { - Ok(None) + // Use libgit2 to check if the remote repository exists + // This is more reliable than HTTP HEAD requests when CGIt is disabled + match git2::Remote::create_detached(url.clone()) { + Ok(mut remote) => match remote.connect(git2::Direction::Fetch) { + Ok(_) => Ok(Some(url)), + Err(_) => Ok(None), + }, + Err(_) => Ok(None), } }