From 4030a202f8f2eeb20d0ecb547a9d656a8e2821c5 Mon Sep 17 00:00:00 2001 From: Namilskyy Date: Mon, 1 Dec 2025 14:32:31 +0300 Subject: Fixed logical issue in --http repo url --- src/net/http_package.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/net/http_package.rs') diff --git a/src/net/http_package.rs b/src/net/http_package.rs index aeff588..92b5ffc 100644 --- a/src/net/http_package.rs +++ b/src/net/http_package.rs @@ -40,17 +40,24 @@ impl HTTPPackage { /// /// Returns an error if the request fails, if the response status is not successful, or if there's an issue while reading or writing the file. pub async fn fetch_index_http(&mut self) -> Result> { - let repo_url_str = &self.config.repo.repo_url; + let repo_url_opt = &self.config.repo.repo_http_url; let cache_dir = &self.config.paths.cache_dir; log::debug!("Cache directory: {:?}", cache_dir); - let index_url = if repo_url_str.ends_with(".tar.gz") { - repo_url_str.clone() - } else { - format!("{}/INDEX.tar.gz", repo_url_str.trim_end_matches('/')) - }; - + let index_url = repo_url_opt.as_deref().map_or_else( + || { + log::warn!("Repository URL is None, please specify it in /etc/mesk/mesk.toml and restart."); + String::new() + }, + |repo_url_str| { + if repo_url_str.ends_with(".tar.gz") { + repo_url_str.to_string() + } else { + format!("{}/INDEX.tar.gz", repo_url_str.trim_end_matches('/')) + } + }, + ); let client = reqwest::Client::new(); // Make a HEAD request to get the content length for the progress bar -- cgit v1.2.3