diff --git a/Cargo.toml b/Cargo.toml index 3161bb7..8dbdbe1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multer" -version = "2.1.0" +version = "3.0.0" description = "An async parser for `multipart/form-data` content-type in Rust." homepage = "https://github.com/rousan/multer-rs" repository = "https://github.com/rousan/multer-rs" diff --git a/src/field.rs b/src/field.rs index c166972..14f7681 100644 --- a/src/field.rs +++ b/src/field.rs @@ -1,4 +1,3 @@ -use std::borrow::Cow; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; @@ -282,15 +281,8 @@ impl<'r> Field<'r> { .unwrap_or(default_encoding); let encoding = Encoding::for_label(encoding_name.as_bytes()).unwrap_or(UTF_8); - let bytes = self.bytes().await?; - - let (text, ..) = encoding.decode(&bytes); - - match text { - Cow::Owned(s) => Ok(s), - Cow::Borrowed(s) => Ok(String::from(s)), - } + Ok(encoding.decode(&bytes).0.into_owned()) } /// Get the index of this field in order they appeared in the stream.