Skip to content

Conversation

@AndreasLF
Copy link
Contributor

Fixes #146

Bug Fix

This change resolves the parsing error for address headers (like From:) that contain an encoded comma. The fix is to parse the raw header with email.utils.getaddresses before decoding with decode_header_part. This ensures the parser treats the encoded word as a single unit and doesn't split it.

Test Correction (for #136)

While implementing this fix, I discovered an issue with test_issue_136. The test was expecting the following output: [("", "notificaccion-clientes@bbva.mx"), ("", "notificaccion-clientes@bbva.mx"),]

I would argue that this is incorrect. The raw From header in that test file is: From: =?UTF-8?B?bm90aWZpY2FjY2lvbi1jbGllbnRlc0BiYnZhLm14?= <notificaccion-clientes@bbva.mx>

This header represents only one address, where the display name is just the encoded version of the email address. The parser correctly decodes the name, sees it's identical to the email, and returns an empty string for the name.

I have updated the test to expect the correct, single-address output: [("", "notificaccion-clientes@bbva.mx"),]

Let me know what you think.

@coveralls
Copy link

Coverage Status

coverage: 99.232% (+0.003%) from 99.229%
when pulling ae02771 on AndreasLF:issue146
into 025f937 on SpamScope:develop.

@fedelemantuano fedelemantuano merged commit 1c700e4 into SpamScope:develop Nov 6, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address header name with encoded comma

3 participants