Skip to content

Bug in Base64MailCodec #247

@sinxwal

Description

@sinxwal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions