This commit is contained in:
parent
cd0fe56c56
commit
a56d990169
1 changed files with 2 additions and 1 deletions
|
@ -30,12 +30,13 @@ impl MirrorRepository {
|
|||
log::info!("Trying mirror {url}");
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
if let Ok(resp) = client.get(url).send().await {
|
||||
if let Ok(resp) = client.get(&url).send().await {
|
||||
if resp.status().is_success() {
|
||||
let data = resp.bytes().await.unwrap().to_vec();
|
||||
let parent = file_path.parent().unwrap();
|
||||
std::fs::create_dir_all(parent).unwrap();
|
||||
|
||||
log::info!("Downloaded {url}");
|
||||
std::fs::write(file_path, data).unwrap();
|
||||
return;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue