delete the files
This commit is contained in:
parent
f85085b445
commit
04892e0b1c
1 changed files with 7 additions and 11 deletions
|
|
@ -444,20 +444,22 @@ pub async fn generate_mii_images(client: Arc<Client>, bucket: &str, pid: i32, mi
|
||||||
println!("Saving temporary file at {}", temp_path);
|
println!("Saving temporary file at {}", temp_path);
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut file = File::create(&temp_path)?;
|
let mut file = std::fs::File::create(&temp_path)?;
|
||||||
file.write_all(data)?;
|
file.write_all(data)?;
|
||||||
file.flush()?; // Make sure file is actually written
|
file.flush()?; // Make sure file is actually written
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("File saved, starting upload to S3...");
|
println!("File saved, starting upload to S3...");
|
||||||
|
let content = ObjectContent::from(std::path::Path::new(&temp_path));
|
||||||
let content = ObjectContent::from(Path::new(&temp_path));
|
|
||||||
client.put_object_content(bucket, key, content).send().await?;
|
client.put_object_content(bucket, key, content).send().await?;
|
||||||
|
|
||||||
println!("Uploaded {} to bucket {}", key, bucket);
|
println!("Uploaded {} to bucket {}", key, bucket);
|
||||||
|
|
||||||
// NOTE: DO NOT delete temp file for now
|
// ✅ Now delete the temp file
|
||||||
println!("(Skipping delete for {})", temp_path);
|
match std::fs::remove_file(&temp_path) {
|
||||||
|
Ok(_) => println!("Deleted temporary file {}", temp_path),
|
||||||
|
Err(e) => println!("Failed to delete temporary file {}: {:?}", temp_path, e),
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -534,9 +536,3 @@ pub async fn generate_mii_images(client: Arc<Client>, bucket: &str, pid: i32, mi
|
||||||
|
|
||||||
println!("Finished Mii image generation for PID {}", pid);
|
println!("Finished Mii image generation for PID {}", pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue