Fix duplicate of extensions

This commit is contained in:
2024-11-11 03:36:59 +01:00
parent d750ef7e36
commit bc22701b47

View File

@@ -132,6 +132,8 @@ pub async fn add(
"file" => { "file" => {
let (og_file_name, ext) = get_file_name_with_extension_from_field(&field, "txt").map_err(|_| ModelError::Any("Failed to get file name".into()))?; let (og_file_name, ext) = get_file_name_with_extension_from_field(&field, "txt").map_err(|_| ModelError::Any("Failed to get file name".into()))?;
tracing::info!("File name: {:?}", og_file_name);
let temp_file_name = if uuid_name { let temp_file_name = if uuid_name {
let temp_file_name = uuid::Uuid::new_v4().to_string(); let temp_file_name = uuid::Uuid::new_v4().to_string();
format!("{}.{}", temp_file_name, ext) format!("{}.{}", temp_file_name, ext)
@@ -139,7 +141,7 @@ pub async fn add(
og_file_name.to_string() og_file_name.to_string()
}; };
let temp_file_name = format!("{}.{}", temp_file_name, ext); tracing::info!("Temp file name: {:?}", temp_file_name);
file_name = Some(temp_file_name.clone()); file_name = Some(temp_file_name.clone());