Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong handling of Content-Transfer-Encoding: binary #555

Open
gpelz-graph-it opened this issue Feb 25, 2025 · 0 comments
Open

Wrong handling of Content-Transfer-Encoding: binary #555

gpelz-graph-it opened this issue Feb 25, 2025 · 0 comments

Comments

@gpelz-graph-it
Copy link

Describe the bug
According to RFC 1341 a message flagged as 'Content-Transfer-Encoding: binary' should not be converted but kept 'as is'.

Problem is:

        switch ($encoding) {
            case IMAP::MESSAGE_ENC_BINARY:
                if (extension_loaded('imap')) {
                    return base64_decode(\imap_binary($value));
                }
                return base64_decode($value);

source: MessageDecoder always applies base64_decode on the content.

This is wrong, and produces broken output.

This is a multi-part message in MIME format.
------=_Part_72_1430376836.1740153200721
Content-Type: text/html; charset=iso-8859-15
Content-Transfer-Encoding: binary

<body> <div style="font-size: 10pt; font-family: Arial, sans-serif; width:600px">       <div style="padding-bottom=15pt">Sehr geehrte Damen und Herren,</div>   <br>    <div style="padding-bottom=5pt">vielen Dank f&uuml;r Ihre Bestellung, bitte beachten Sie das Pr&uuml;fzeugnis im Anhang.</div></body>

------=_Part_72_1430376836.1740153200721
Content-Type: application/pdf; name=Pruefzeugnis_PZ-2025-0075307.pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=Pruefzeugnis_PZ-2025-0075307.pdf
Content-ID: <Pruefzeugnis_PZ-2025-0075307.pdf>
...

will result in a broken output.

nrv+)^~ȳ{])'ښ)r�Ƨ�'aM)دܥzv)-Rz�ykڙޮدnbrZuا&o^6ZȆz^[imzty֬>Wz'Ȧ�xZ�݊ۡ

Would be nice if this could be fixed to comply with RFC 1341.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant