mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
Remove unwrap from example-stream-to-file
This commit is contained in:
@@ -86,7 +86,7 @@ async fn show_form() -> Html<&'static str> {
|
|||||||
|
|
||||||
// Handler that accepts a multipart form upload and streams each field to a file.
|
// Handler that accepts a multipart form upload and streams each field to a file.
|
||||||
async fn accept_form(mut multipart: Multipart) -> Result<Redirect, (StatusCode, String)> {
|
async fn accept_form(mut multipart: Multipart) -> Result<Redirect, (StatusCode, String)> {
|
||||||
while let Some(field) = multipart.next_field().await.unwrap() {
|
while let Ok(Some(field)) = multipart.next_field().await {
|
||||||
let file_name = if let Some(file_name) = field.file_name() {
|
let file_name = if let Some(file_name) = field.file_name() {
|
||||||
file_name.to_owned()
|
file_name.to_owned()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user