feature/handle-duplicate-file-name-upload #22

Merged
cameron merged 5 commits from feature/handle-duplicate-file-name-upload into master 2024-01-18 03:40:23 +00:00
Showing only changes of commit 195d522f64 - Show all commits

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);