Skip to content

Commit 33c795a

Browse files
committed
Revert "feat: remove guest image file if sha256 is error"
This reverts commit 7a9230a.
1 parent 7a9230a commit 33c795a

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

xtask/src/image.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,10 @@ async fn image_download(image_name: &str, output_dir: Option<String>, extract: b
329329
return Ok(());
330330
}
331331
Ok(false) => {
332-
println!("File verification failed, SHA256 does not match, removing corrupted file and re-downloading");
333-
if let Err(e) = fs::remove_file(&output_path) {
334-
println!("Warning: Failed to remove corrupted file: {}", e);
335-
} else {
336-
println!("Corrupted file removed successfully");
337-
}
332+
println!("File verification failed, SHA256 does not match, will re-download");
338333
}
339334
Err(e) => {
340-
println!("Error verifying file: {}, removing potentially corrupted file and re-downloading", e);
341-
if let Err(remove_err) = fs::remove_file(&output_path) {
342-
println!("Warning: Failed to remove potentially corrupted file: {}", remove_err);
343-
} else {
344-
println!("Potentially corrupted file removed successfully");
345-
}
335+
println!("Error verifying file: {}, will re-download", e);
346336
}
347337
}
348338
} else {
@@ -377,21 +367,9 @@ async fn image_download(image_name: &str, output_dir: Option<String>, extract: b
377367
println!("Download completed, file verification successful");
378368
}
379369
Ok(false) => {
380-
println!("SHA256 verification failed, removing corrupted file...");
381-
if let Err(e) = fs::remove_file(&output_path) {
382-
println!("Warning: Failed to remove corrupted file: {}", e);
383-
} else {
384-
println!("Corrupted file removed successfully");
385-
}
386370
return Err(anyhow!("Downloaded file SHA256 verification failed"));
387371
}
388372
Err(e) => {
389-
println!("Error verifying file, removing potentially corrupted file...");
390-
if let Err(remove_err) = fs::remove_file(&output_path) {
391-
println!("Warning: Failed to remove potentially corrupted file: {}", remove_err);
392-
} else {
393-
println!("Potentially corrupted file removed successfully");
394-
}
395373
return Err(anyhow!("Error verifying downloaded file: {}", e));
396374
}
397375
}

0 commit comments

Comments
 (0)