diff options
| author | Namilskyy <alive6863@gmail.com> | 2025-12-01 14:32:31 +0300 |
|---|---|---|
| committer | Namilskyy <alive6863@gmail.com> | 2025-12-01 14:32:31 +0300 |
| commit | 4030a202f8f2eeb20d0ecb547a9d656a8e2821c5 (patch) | |
| tree | 3fc78ce44f3c4dc748e0d4e27418262f3e42a1b3 /src/net | |
| parent | b157e34176858766738be7e6903cc188285a5aeb (diff) | |
Fixed logical issue in --http repo url
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/http_package.rs | 21 |
1 files changed, 14 insertions, 7 deletions
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<bool, Box<dyn std::error::Error>> { - 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 |
