Skip to content

Commit 5dea371

Browse files
committed
fix: shortest content disposition is 19 rather than 20
1 parent 9110b0c commit 5dea371

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub(crate) const CRLFS: [u8; 4] = [b'\r', b'\n', b'\r', b'\n']; // `\r\n\r\n`
1111
const NAME: &[u8; 4] = b"name";
1212
const FILE_NAME: &[u8; 8] = b"filename";
1313
const FORM_DATA: &[u8; 9] = b"form-data";
14+
const SHORTEST_CONTENT_DISPOSITION: &[u8; 19] = b"form-data; name=\"s\"";
1415

1516
pub(crate) fn parse_content_type(header: Option<&HeaderValue>) -> Option<mime::Mime> {
1617
header
@@ -40,7 +41,7 @@ pub(crate) fn parse_part_headers(bytes: &[u8]) -> Result<HeaderMap> {
4041

4142
#[allow(clippy::many_single_char_names)]
4243
pub(crate) fn parse_content_disposition(hv: &[u8]) -> Result<(String, Option<String>)> {
43-
if hv.len() < 20 {
44+
if hv.len() < SHORTEST_CONTENT_DISPOSITION.len() {
4445
return Err(Error::InvalidContentDisposition);
4546
}
4647

0 commit comments

Comments
 (0)