Add file upload log in happy path and update log level for duplicate path

This commit is contained in:
Cameron Cordes
2024-01-17 21:00:15 -05:00
parent 6c5014253f
commit 195d522f64

View File

@@ -163,8 +163,10 @@ async fn upload_image(
true, true,
) { ) {
if !full_path.is_file() && is_image_or_video(&full_path) { if !full_path.is_file() && is_image_or_video(&full_path) {
let mut file = File::create(full_path).unwrap(); let mut file = File::create(&full_path).unwrap();
file.write_all(&file_content).unwrap(); file.write_all(&file_content).unwrap();
info!("Uploaded: {:?}", full_path);
} else { } else {
warn!("File already exists: {:?}", full_path); warn!("File already exists: {:?}", full_path);
@@ -415,7 +417,7 @@ fn create_thumbnails() {
let thumb_path = Path::new(thumbnail_directory).join(relative_path); let thumb_path = Path::new(thumbnail_directory).join(relative_path);
std::fs::create_dir_all(thumb_path.parent().unwrap()) std::fs::create_dir_all(thumb_path.parent().unwrap())
.expect("There was an issue creating directory"); .expect("There was an issue creating directory");
debug!("Saving thumbnail: {:?}", thumb_path); info!("Saving thumbnail: {:?}", thumb_path);
image.save(thumb_path).expect("Failure saving thumbnail"); image.save(thumb_path).expect("Failure saving thumbnail");
}) })
.for_each(drop); .for_each(drop);