diff --git a/download-utils/src/lib.rs b/download-utils/src/lib.rs index c7645af29..ec4b3747f 100644 --- a/download-utils/src/lib.rs +++ b/download-utils/src/lib.rs @@ -34,9 +34,18 @@ pub fn download_file( } let download_start = Instant::now(); - fs::create_dir_all(destination_file.parent().unwrap()).map_err(|err| err.to_string())?; + fs::create_dir_all(destination_file.parent().expect("parent")) + .map_err(|err| err.to_string())?; - let temp_destination_file = destination_file.with_extension("tmp"); + let mut temp_destination_file = destination_file.to_path_buf(); + temp_destination_file.set_file_name(format!( + "tmp-{}", + destination_file + .file_name() + .expect("file_name") + .to_str() + .expect("to_str") + )); let progress_bar = new_spinner_progress_bar(); if use_progress_bar {