remail: Simplify msg_set_header()

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Thomas Gleixner 2023-06-18 18:23:36 +02:00
parent 88f8e48b13
commit c3b13e47f7

View file

@ -195,12 +195,10 @@ def msg_set_header(msg, hdr, txt):
# come with wreckaged headers.
txt = re_rmlfcr.sub(' ', txt)
for k in msg.keys():
if hdr.lower() == k.lower():
msg.replace_header(k, txt)
return
# Not found set new
msg[hdr] = txt
if msg.get(hdr):
msg.replace_header(hdr, txt)
else:
msg[hdr] = txt
payload_valid_mime_headers = [
'Content-Description',