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 <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-11-18 09:54:36 -05:00
parent 3a8b556dcc
commit 49d5be8a76
1 changed files with 4 additions and 2 deletions

View File

@ -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