We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e5ffa9 commit c625032Copy full SHA for c625032
1 file changed
src/main.rs
@@ -567,8 +567,17 @@ async fn ax_post_file(
567
let mut upload_result: Option<(StatusCode, Vec<u8>)> = None;
568
let mut buffered_file: Option<tempfile::NamedTempFile> = None;
569
570
- while let Some(field) = multipart.next_field().await.unwrap() {
571
- let name = field.name().unwrap().to_string();
+ while let Some(field) = match multipart.next_field().await {
+ Ok(field) => field,
572
+ Err(e) => {
573
+ eprintln!("Error reading multipart field: {:?}", e);
574
+ return (StatusCode::BAD_REQUEST, b"Malformed multipart request".to_vec());
575
+ }
576
+ } {
577
+ let name = match field.name() {
578
+ Some(name) => name.to_string(),
579
+ None => continue,
580
+ };
581
let filename = field.file_name().map(|f| f.to_string());
582
583
if name == "path" {
0 commit comments