Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions email_priority_classifier/type/classified_email_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import base64
import json
import re

_LABEL_REPLACE_DATA = {
"INBOX": "Inbox",
Expand Down Expand Up @@ -37,8 +38,7 @@ def _extract_subject_from_payload(payload: dict) -> str:

@staticmethod
def _decode_body(body: str, headers: list[dict]) -> str:
return (base64.urlsafe_b64decode(body).decode("utf-8")
.replace("\r", "").replace("\n", "").replace("\t", ""))
return re.sub(r"\s+", " ", base64.urlsafe_b64decode(body).decode("utf-8"))
"""
for header in headers:
if header.get("name", "").lower() == 'content-transfer-encoding':
Expand Down
Loading