diff --git a/src/api/mt_form.rs b/src/api/mt_form.rs index 7a120c3..0004759 100644 --- a/src/api/mt_form.rs +++ b/src/api/mt_form.rs @@ -222,14 +222,13 @@ impl MtForm { pub async fn mt_form(MultipartForm(form): MultipartForm) -> HttpResponse { let first = form.first_name.clone(); let last = form.last_name.clone(); - let email_subject = format!("{} {} signed up for mission trip!", first, last); let filename_noext = format!("{}_{}", first, last); + let email_subject = format!("{} {} signed up for mission trip!", first, last); info!("{first} {last} signed up for mission trip!"); let email = form.build_email().await; let mut path = String::from(""); let mut file_exists = false; let mut filename = String::from(""); - info!("{:?}", file_exists); if let Some(file) = form.file.file_name { if let Some(ext) = file.rsplit('.').next() { filename = format!("{}.{}", filename_noext, ext); @@ -237,14 +236,13 @@ pub async fn mt_form(MultipartForm(form): MultipartForm) -> HttpResponse } else { path = format!("./tmp/{}", file); } - // let path = format!("./tmp/{}", file); info!("saving to {}", path); match form.file.file.persist(&path) { Ok(f) => { - info!("{:?}", f); if f.metadata().unwrap().len() > 0 { file_exists = true; } + info!(?f, "File saved successfully"); } Err(e) => info!("{:?}: Probably a missing image", e), } @@ -254,7 +252,7 @@ pub async fn mt_form(MultipartForm(form): MultipartForm) -> HttpResponse let filebody = fs::read(path); let content_type = ContentType::parse("image/jpg").unwrap(); let attachment = Attachment::new(filename).body(filebody.unwrap(), content_type); - info!("{:?}", attachment); + // info!(?attachment); MultiPart::mixed() .singlepart(SinglePart::html(email.into_string())) .singlepart(attachment)