Skip to content

Commit

Permalink
fix: handle none value (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
yktakaha4 authored Feb 19, 2024
1 parent 93278bc commit d512b9f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion parsedmarc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def to_str(obj):
row["dmarc_aligned"] = record["alignment"]["dmarc"]
row["disposition"] = record["policy_evaluated"]["disposition"]
policy_override_reasons = list(map(
lambda r_: r_["type"],
lambda r_: r_["type"] or "none",
record["policy_evaluated"]
["policy_override_reasons"]))
policy_override_comments = list(map(
Expand Down
56 changes: 56 additions & 0 deletions samples/aggregate/empty_reason.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<feedback>
<version>1.0</version>
<report_metadata>
<org_name>example.org</org_name>
<email>[email protected]</email>
<extra_contact_info>https://support.example.org/dmarc</extra_contact_info>
<report_id>20240125141224705995</report_id>
<date_range>
<begin>1706159544</begin>
<end>1706185733</end>
</date_range>
</report_metadata>
<policy_published>
<domain>example.com</domain>
<adkim>r</adkim>
<aspf>r</aspf>
<p>quarantine</p>
<sp>quarantine</sp>
<pct>100</pct>
<fo>1</fo>
</policy_published>
<record>
<row>
<source_ip>198.51.100.123</source_ip>
<count>2</count>
<policy_evaluated>
<disposition>none</disposition>
<dkim>pass</dkim>
<spf>fail</spf>
<reason>
<type></type>
<comment></comment>
</reason>
</policy_evaluated>
</row>
<identifiers>
<envelope_to>example.net</envelope_to>
<envelope_from>example.edu</envelope_from>
<header_from>example.com</header_from>
</identifiers>
<auth_results>
<dkim>
<domain>example.com</domain>
<selector>example</selector>
<result>pass</result>
<human_result>2048-bit key</human_result>
</dkim>
<spf>
<domain>example.edu</domain>
<scope>mfrom</scope>
<result>pass</result>
</spf>
</auth_results>
</record>
</feedback>

0 comments on commit d512b9f

Please sign in to comment.