mguessan / davmail

DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway - Synced with main subversion repository at
http://davmail.sourceforge.net
GNU General Public License v2.0
580 stars 86 forks source link

Fix BODYSTRUCTURE response #239

Closed cketti closed 1 year ago

cketti commented 2 years ago

Fixes https://sourceforge.net/p/davmail/bugs/723/

mguessan commented 1 year ago

Patch merged, thanks for your contribution.

I just left an additional fallback case on bodystructure type. Can you please confirm ?

cketti commented 1 year ago

@mguessan: The line count value must only be present for text parts. Non-text parts must omit that value.

Here's the comment we have in K-9 Mail to illustrate how the indices of values are different for text parts and non-text parts:

/*
 *  0| 0  body type
 *  1| 1  body subtype
 *  2| 2  body parameter parenthesized list
 *  3| 3  body id (unused)
 *  4| 4  body description (unused)
 *  5| 5  body encoding
 *  6| 6  body size
 *  -| 7  text lines (only for type TEXT, unused)
 * Extensions (optional):
 *  7| 8  body MD5 (unused)
 *  8| 9  body disposition
 *  9|10  body language (unused)
 * 10|11  body location (unused)
 */

Your additional else case writes out the value 0 that will be interpreted as body MD5 value by implementations that support reading optional extensions.