From 49d5be8a76acb2f95221a0de9a3024028c4f354d Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 18 Nov 2016 09:54:36 -0500 Subject: [PATCH] Decode base64 encoded messages before posting This is needed to unscramble the encoded string, otherwise we won't be able to find the thread id or message. Signed-off-by: Anna Schumaker --- slackpost.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/slackpost.py b/slackpost.py index f7cde12..d487d1f 100755 --- a/slackpost.py +++ b/slackpost.py @@ -26,10 +26,12 @@ if addr.replace(".", "") != slack.user().email().replace(".", ""): if headers.is_multipart(): for part in headers.get_payload(): if part.get_content_type() == "text/plain": - payload = part.get_payload() + payload = part.get_payload(decode = True) else: - payload = headers.get_payload() + payload = headers.get_payload(decode = True) +if type(payload) is bytes: + payload = payload.decode() # # Find the thread id in the message payload