From 343b53ef18d3bb9bc487dd0b53a5a180f174c395 Mon Sep 17 00:00:00 2001 From: maraspr <42643683+maraspr@users.noreply.github.com> Date: Thu, 8 Jan 2026 18:24:20 +0100 Subject: [PATCH] remove newlines before b64decode (#649) --- parsedmarc/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index cf8197c..60c4be7 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -892,7 +892,11 @@ def extract_report(content: Union[bytes, str, BinaryIO]) -> str: try: if isinstance(content, str): try: - file_object = BytesIO(b64decode(content, validate=True)) + file_object = BytesIO( + b64decode( + content.replace("\n", "").replace("\r", ""), validate=True + ) + ) except binascii.Error: return content header = file_object.read(6)