encode the find and replaces for b64 decode

This commit is contained in:
revsuine 2024-11-14 18:46:30 +00:00
parent 158f5356a1
commit 9a3a1f2cb7
Signed by: revsuine
GPG key ID: 3F257B68F5BC9339

View file

@ -82,8 +82,8 @@ def decode_email(message: email.message.Message) -> email.message.Message:
for part in quopri_decoded_message.walk(): for part in quopri_decoded_message.walk():
if not part.is_multipart(): if not part.is_multipart():
if part.get("Content-Transfer-Encoding") == "base64": if part.get("Content-Transfer-Encoding") == "base64":
b64_str = part.get_payload() b64_str = part.get_payload().encode()
decoded_b64_str = part.get_payload(decode=True) decoded_b64_str = part.get_payload(decode=True).encode()
decoded_bytes = decoded_bytes.replace( decoded_bytes = decoded_bytes.replace(
b64_str, b64_str,
decoded_b64_str decoded_b64_str