Remove unnecessary unwrap
in multipart handler
The call to `unwrap` is not save at this point and will panic on connection errors/disconnects. Instead a `ParseRequestError::InvalidMultipart(multer::Error)` will now get returned instead.
This commit is contained in:
parent
5eafa69626
commit
23a0c84aa9
|
@ -85,7 +85,7 @@ pub(super) async fn receive_batch_multipart(
|
|||
if let Some(filename) = field.file_name().map(ToString::to_string) {
|
||||
let content_type = field.content_type().map(ToString::to_string);
|
||||
let mut file = tempfile::tempfile().map_err(ParseRequestError::Io)?;
|
||||
while let Some(chunk) = field.chunk().await.unwrap() {
|
||||
while let Some(chunk) = field.chunk().await? {
|
||||
file.write(&chunk).map_err(ParseRequestError::Io)?;
|
||||
}
|
||||
file.seek(SeekFrom::Start(0))?;
|
||||
|
|
Loading…
Reference in New Issue
Block a user