Skip to content

Commit 3dc187f

Browse files
committed
fixed bug with binary data transfer
1 parent 1ecfc28 commit 3dc187f

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/Management.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,11 @@ public function processMessage(MessageInterface $message, MimePart $payload)
235235
]
236236
);
237237

238-
// $body = $request->getBody()->getContents();
239-
// $encoding = $request->getHeaderLine('content-transfer-encoding');
240-
// if (! $encoding) {
241-
// $encoding = $request->getHeaderLine('content-encoding');
242-
// if (! $encoding) {
243-
// $encoding = $sender->getContentTransferEncoding();
244-
// }
245-
// }
246-
// // Force encode binary data to base64, because openssl_pkcs7 doesn't work with binary data
247-
// if ($encoding != 'base64') {
248-
// $request = $request->withHeader('Content-Transfer-Encoding', 'base64');
249-
// $body = Utils::encodeBase64($body);
250-
// }
251-
// $payload = new MimePart($request->getHeaders(), $body);
238+
// Force encode binary data to base64, `openssl_pkcs7_` doesn't work with binary data
239+
$body = $payload->getBody();
240+
$body = Utils::normalizeBase64($body);
241+
$body = Utils::encodeBase64($body);
242+
$payload->setBody($body);
252243

253244
// Check if message from this partner are expected to be encrypted
254245
if (! $payload->isEncrypted() && $message->getSender()->getEncryptionAlgorithm()) {

0 commit comments

Comments
 (0)