Skip to content

Fix binary attachment and Content-Disposition header handling#8

Open
jacekkow wants to merge 2 commits into
opcodesio:mainfrom
jacekkow:main
Open

Fix binary attachment and Content-Disposition header handling#8
jacekkow wants to merge 2 commits into
opcodesio:mainfrom
jacekkow:main

Conversation

@jacekkow
Copy link
Copy Markdown

While trying to use this library I have noticed two problems:

  1. Some binary attachments in S/MIME signed e-mail were not rejected by ASN.1 parser. It turns out that the 0x0D 0x0A byte sequence is unconditionally replaced by 0x0A. Solution: do not touch attachments, return their content as-is.

  2. Content-Disposition header is case-sensitive, even though relevant documentation states it must be case-insensitive. Solution: case fold value before comparison and add i flag to regexps.

jacekkow added 2 commits May 22, 2026 11:14
Binary files do not like to have 0x0D 0x0A replaced with 0x0A
Per RFC6266:

> If the disposition type matches "attachment" (case-insensitively) (...)

> The parameters "filename" and "filename*", to be matched case-insensitively (...)
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.

1 participant