From 6671fe926ef6a2b79c494b69ffe40577a829b964 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Thu, 2 Jan 2020 00:08:39 +0200 Subject: [PATCH] melib: don't treat missing end boundary as error Don't treat missing end boundary as error in multipart attachments. python3's nntplib seems to return MIME attachments with this property --- melib/src/email/parser.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/melib/src/email/parser.rs b/melib/src/email/parser.rs index 4efd2e91..7a2aad28 100644 --- a/melib/src/email/parser.rs +++ b/melib/src/email/parser.rs @@ -750,9 +750,12 @@ pub fn multipart_parts<'a>(input: &'a [u8], boundary: &[u8]) -> IResult<&'a [u8] offset += 2; input = &input[2..]; } - continue; } else { - return IResult::Error(error_code!(ErrorKind::Custom(43))); + ret.push(StrBuilder { + offset, + length: input.len(), + }); + break; } } IResult::Done(input, ret) @@ -805,9 +808,9 @@ fn parts_f<'a>(input: &'a [u8], boundary: &[u8]) -> IResult<&'a [u8], Vec<&'a [u } else if input[0..].starts_with(b"\r\n") { input = &input[2..]; } - continue; } else { - return IResult::Error(error_code!(ErrorKind::Custom(43))); + ret.push(input); + break; } } IResult::Done(input, ret)