From 569b8b95d65155141b32e2b5d0384cbf7209e6c3 Mon Sep 17 00:00:00 2001 From: Tim Schubert Date: Thu, 2 May 2024 21:16:02 +0200 Subject: [PATCH] Fix handling of missing headers --- bin/mailbox2matrix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/mailbox2matrix b/bin/mailbox2matrix index ac62fe2..bea7a63 100755 --- a/bin/mailbox2matrix +++ b/bin/mailbox2matrix @@ -18,12 +18,16 @@ def decode(header): class Client(AsyncClient): def send_message(self, From, Subject): + if From is not None: + From = decode(From) + if From is not None: + Subject = decode(Subject) return self.room_send( room_id=self.room, message_type="m.room.message", content={ "msgtype": "m.text", - "body": "From:\t%s\nSubject:\t%s" % (decode(From), decode(Subject)) + "body": "From:\t%s\nSubject:\t%s" % (From, Subject) } )