diff --git a/pyas2lib/tests/test_advanced.py b/pyas2lib/tests/test_advanced.py index 5179513..10f83d1 100644 --- a/pyas2lib/tests/test_advanced.py +++ b/pyas2lib/tests/test_advanced.py @@ -52,9 +52,8 @@ def test_binary_message(self): ) # Compare the mic contents of the input and output messages - # self.assertEqual(original_message, - # in_message.payload.get_payload(decode=True)) self.assertEqual(status, "processed") + self.assertEqual(original_message, in_message.payload.get_payload(decode=True)) self.assertTrue(in_message.signed) self.assertTrue(in_message.encrypted) self.assertEqual(out_message.mic, in_message.mic) diff --git a/pyas2lib/utils.py b/pyas2lib/utils.py index f50f5c3..200294c 100644 --- a/pyas2lib/utils.py +++ b/pyas2lib/utils.py @@ -45,12 +45,10 @@ def _handle_text(self, msg): Handle writing the binary messages to prevent default behaviour of newline replacements. """ - if msg.get( - "Content-Transfer-Encoding" - ) == "binary" and msg.get_content_subtype() in [ - "pkcs7-mime", - "pkcs7-signature", - ]: + if msg.get_content_type() == "application/octet-stream" or ( + msg.get("Content-Transfer-Encoding") == "binary" + and msg.get_content_subtype() in ["pkcs7-mime", "pkcs7-signature",] + ): payload = msg.get_payload(decode=True) if payload is None: return