Skip to content

Commit

Permalink
Fix incorrect parsing of headers containing equal character (#7303)
Browse files Browse the repository at this point in the history
* 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 <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f4237dd)
  • Loading branch information
Theo024 authored and patchback[bot] committed Sep 22, 2023
1 parent d237faa commit 0848f40
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 0848f40

Please sign in to comment.