-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix crash when email headers contained unencoded unicode
- Loading branch information
Showing
3 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from io import BytesIO | ||
from pathlib import Path | ||
|
||
from ..email_parsing import parse_email | ||
from .test_email_log_parsing import TEST_DATA_ROOT | ||
|
||
|
||
def test_parse_utf8_subject(): | ||
with open(Path(TEST_DATA_ROOT) / "email_utf8-subject.eml", "rb") as f: | ||
email = parse_email(BytesIO(f.read())) | ||
|
||
assert email.subject.startswith( | ||
"utf8-subject - äöüß - " | ||
) # putting unicode directly into an email is undefined, so we only check for the well-formatted part of the subject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Return-Path: <MAILER-DAEMON> | ||
Message-Id: <12345678@localhost> | ||
From: Mitgliederservice <1234@localhost> | ||
Subject: utf8-subject - =?utf-8?Q?=C3=A4=C3=B6=C3=BC=C3=9F?= - 🥲 | ||
To: mail@mail.example.com | ||
Content-Transfer-Encoding: 7bit | ||
Content-Type: text/html; charset=UTF-8 | ||
Date: Wed, 13 Nov 2024 20:49:29 +0100 | ||
|
||
EMail-Body |