diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-07-08 16:52:17 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-07-08 16:52:33 +0200 |
commit | 8bfe61d767209585b47d4c6e4344387fc01d4098 (patch) | |
tree | 8092fa34fc9c57000c544b8a7893b8ef23768849 /src/imap | |
parent | b1b73a9be574e27903671ad9f8dc437bb09c9e00 (diff) | |
download | aerogramme-8bfe61d767209585b47d4c6e4344387fc01d4098.tar.gz aerogramme-8bfe61d767209585b47d4c6e4344387fc01d4098.zip |
Count lines the same way as Dovecot+Cyrus
Diffstat (limited to 'src/imap')
-rw-r--r-- | src/imap/mailbox_view.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/imap/mailbox_view.rs b/src/imap/mailbox_view.rs index bffcd9b..c687f66 100644 --- a/src/imap/mailbox_view.rs +++ b/src/imap/mailbox_view.rs @@ -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(), )?, }, }, |