Skip to content

mail-parser treats multiparts as attachments #128

@ItayBenAvi

Description

@ItayBenAvi

Describe the bug
mail-parser fails on mails that have multipart attachments
mail-parsers fails in core.py:473
Traceback:
AttributeError: 'NoneType' object has no attribute 'decode'

This happens because of recent change in line core.py:353:
"or ported_string(p.get_content_disposition()).lower() == "attachment""

To Reproduce
Create a part which is multipart with content-disposition of attachment

Expected behavior
Payload should be treated as multipart and as attachment

It can be resolved by changing core.py:353 from 'or' to 'and' statement

Raw mail
Un-fortunately, I can't add the mail for security reason.
The mail have a part with the following payload:

  • content-disposition: attachment
  • p.is_multipart == True

Environment:

  • OS: Linux
  • Docker: yes
  • mail-parser version 4.1.2 (doesn't re-produce on 3.5.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions