Skip to content

[MIME] Missing possibility to create DataPart with binary encoding #60301

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

Open
cpernot-hf opened this issue Apr 29, 2025 · 0 comments
Open

[MIME] Missing possibility to create DataPart with binary encoding #60301

cpernot-hf opened this issue Apr 29, 2025 · 0 comments

Comments

@cpernot-hf
Copy link

cpernot-hf commented Apr 29, 2025

Symfony version(s) affected

6.4.17

Description

When creating a DataPart object, $encoding parameter is limited to 'quoted-printable', 'base64' or '8bit' by this code in TextPart.php:

if ('quoted-printable' !== $encoding && 'base64' !== $encoding && '8bit' !== $encoding) {
    throw new InvalidArgumentException(sprintf('The encoding must be one of "quoted-printable", "base64", or "8bit" ("%s" given).', $encoding));
}

We are missing the possiblity to set a binary encoding to create OData batch request, as each part must have a binary encoding (https://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398359) : A MIME part representing an individual request MUST include a Content-Type header with value application/http and a Content-Transfer-Encoding header with value binary.

From MIME RFC1341 (https://www.w3.org/Protocols/rfc1341/5_Content-Transfer-Encoding.html) it seems binary is just like 8bit, but without any line-length limit.

How to reproduce

new DataPart($bodyAsString, null, 'application/http', 'binary');

throws the above exception

InvalidArgumentException('The encoding must be one of "quoted-printable", "base64", or "8bit" ("binary" given).');

Possible Solution

Maybe it's possible to treat "binary" as an alias of "8bit"

Additional Context

No response

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

No branches or pull requests

2 participants