Enough-Software / enough_mail

IMAP, POP3 and SMTP clients for Dart developers. Contains both low level as well as a high level API.
Mozilla Public License 2.0
104 stars 55 forks source link

Bug in Base64MailCodec #247

Open sinxwal opened 1 month ago

sinxwal commented 1 month ago

In several mail accounts i have noticed this error with message body decoding: Exception has occurred. FormatException (FormatException: Invalid character (at character 999) ...JuYWxDbGFzcyB0ZCwKLkV4dGVybmFsQ2xhc3 MgZGl2IHsKbGluZS1oZWlnaHQ6IDEwMCU7C...

Error occurs in messages with base64 encoded boundary, see the space symbol here 3 M.

Here is the current decodeData impl (Base64MailCodec decodeData method). var cleaned = part.replaceAll('\r\n', '');

My workaround is to rewrite it like this: var cleaned = part.replaceAll(RegExp('\r\n| '), '');

Example message:

boundary
sinxwal commented 1 month ago

@robert-virkus Maybe we can override Base64MailCodec with a custom implementation?