1
0
Fork 0
mirror of https://github.com/tokio-rs/axum.git synced 2025-04-26 13:56:22 +02:00

Remove unwrap from example-stream-to-file

This commit is contained in:
David Pedersen 2023-07-01 23:09:46 +02:00
parent 99e8828df5
commit f4accdc95d

View file

@ -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.
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() {
file_name.to_owned()
} else {