Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle none value #468

Merged

Conversation

yktakaha4
Copy link
Contributor

Thank you to all the maintainers.

In my use case, I encountered the below error.

Traceback (most recent call last):
  File "tests.py", line [39](https://github.com/yktakaha4/parsedmarc/actions/runs/7691856259/job/20957819252?pr=1#step:8:40), in testAggregateSamples
    parsedmarc.parsed_aggregate_reports_to_csv(parsed_report)
  File "/home/runner/work/parsedmarc/parsedmarc/parsedmarc/__init__.py", line 583, in parsed_aggregate_reports_to_csv
    rows = parsed_aggregate_reports_to_csv_rows(reports)
  File "/home/runner/work/parsedmarc/parsedmarc/parsedmarc/__init__.py", line 517, in parsed_aggregate_reports_to_csv_rows
    row["policy_override_reasons"] = ",".join(
TypeError: sequence item 0: expected str instance, NoneType found

It turned out that the None check was missing in the following places, so I fixed it.
I've also added test data to verify the fix.

lambda r_: r_["type"],

I believe that the CI failure will be resolved by merging the PR below.
#466

Comment on lines +31 to +34
<reason>
<type></type>
<comment></comment>
</reason>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An error occurs when processing such data.

@seanthegeek seanthegeek merged commit d512b9f into domainaware:master Feb 19, 2024
seanthegeek added a commit that referenced this pull request Feb 20, 2024
- Add support for SMTP TLS reports (PR #453 closes issue #71)
- Do not replace content in forensic samples (fix #403)
- Pin `msgraph-core` dependency at version `0.2.2` until Microsoft provides better documentation (PR #466 Close [#464](#464))
- Properly handle base64-encoded email attachments (PR #453)
- Do not crash when attempting to parse invalid email content (PR #453)
- Ignore errors when parsing text-based forensic reports (PR #460)
- Add email date to email processing debug logs (PR #462)
- Set default batch size to 10 to match the documentation (PR #465)
- Properly handle none values (PR #468)
- Add Gmail pagination (PR #469)
- Use the correct `msgraph` scope (PR #471)
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.

None yet

2 participants