Count lines the same way as Dovecot+Cyrus

This commit is contained in:
Quentin 2022-07-08 16:52:17 +02:00
parent b1b73a9be5
commit 8bfe61d767
Signed by: quentin
GPG key ID: E9602264D639FF68

View file

@ -568,7 +568,10 @@ fn build_imap_email_struct<'a>(
specific: SpecificFields::Text {
subtype,
number_of_lines: u32::try_from(
Cursor::new(bp.body_raw.as_ref()).lines().count(),
// We do not count the number of lines but the number of line
// feeds to have the same behavior as Dovecot and Cyrus.
// 2 lines = 1 line feed.
bp.body_raw.as_ref().iter().filter(|&c| c == &b'\n').count(),
)?,
},
},