mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #7303/f4237dde backport][stable-7] Fix incorrect parsing of headers containing equal character (#7306)
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 <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f4237dde1b
)
Co-authored-by: Théo Lévesque <Theo024@users.noreply.github.com>
This commit is contained in:
parent
58ba101990
commit
c47888a5f9
2 changed files with 3 additions and 1 deletions
|
@ -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).
|
|
@ -354,7 +354,7 @@ def main():
|
||||||
# NOTE: Backward compatible with old syntax using '|' as delimiter
|
# NOTE: Backward compatible with old syntax using '|' as delimiter
|
||||||
for hdr in [x.strip() for x in header.split('|')]:
|
for hdr in [x.strip() for x in header.split('|')]:
|
||||||
try:
|
try:
|
||||||
h_key, h_val = hdr.split('=')
|
h_key, h_val = hdr.split('=', 1)
|
||||||
h_val = to_native(Header(h_val, charset))
|
h_val = to_native(Header(h_val, charset))
|
||||||
msg.add_header(h_key, h_val)
|
msg.add_header(h_key, h_val)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
Loading…
Reference in a new issue