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,11 +195,9 @@ def msg_set_header(msg, hdr, txt):
# come with wreckaged headers. # come with wreckaged headers.
txt = re_rmlfcr.sub(' ', txt) txt = re_rmlfcr.sub(' ', txt)
for k in msg.keys(): if msg.get(hdr):
if hdr.lower() == k.lower(): msg.replace_header(hdr, txt)
msg.replace_header(k, txt) else:
return
# Not found set new
msg[hdr] = txt msg[hdr] = txt
payload_valid_mime_headers = [ payload_valid_mime_headers = [