Skip to content

Commit

Permalink
[PR #7303/f4237dde backport][stable-6] Fix incorrect parsing of heade…
Browse files Browse the repository at this point in the history
…rs containing equal character (#7305)

Fix incorrect parsing of headers containing equal character (#7303)

* Fix incorrect parsing of header containing equal character

* Add changelog fragment

* Update changelogs/fragments/7303-mail-incorrect-header-parsing.yml

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
(cherry picked from commit f4237dd)

Co-authored-by: Théo Lévesque <[email protected]>
  • Loading branch information
patchback[bot] and Theo024 authored Sep 22, 2023
1 parent d237faa commit d5efc3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/7303-mail-incorrect-header-parsing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- mail - skip headers containing equals characters due to missing ``maxsplit`` on header key/value parsing (https://github.com/ansible-collections/community.general/pull/7303).
2 changes: 1 addition & 1 deletion plugins/modules/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def main():
# NOTE: Backward compatible with old syntax using '|' as delimiter
for hdr in [x.strip() for x in header.split('|')]:
try:
h_key, h_val = hdr.split('=')
h_key, h_val = hdr.split('=', 1)
h_val = to_native(Header(h_val, charset))
msg.add_header(h_key, h_val)
except Exception:
Expand Down

0 comments on commit d5efc3f

Please sign in to comment.