diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2023-06-18 18:23:36 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2023-06-20 23:43:23 +0200 |
commit | c3b13e47f7fe99f3381726fd11dd317cbcc6622e (patch) | |
tree | 8ca13d0e08b8ff41e99ac74a8ff36ab54cf72f9b | |
parent | 88f8e48b13810001ca021a396caae6d965a8676a (diff) | |
download | remail-c3b13e47f7fe99f3381726fd11dd317cbcc6622e.tar.gz |
remail: Simplify msg_set_header()
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | remail/mail.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/remail/mail.py b/remail/mail.py index 440eecc..4ec3eaa 100644 --- a/remail/mail.py +++ b/remail/mail.py @@ -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', |