add debugging and handle no content disposition
This commit is contained in:
parent
6babc1b53b
commit
41a9b6e73f
1 changed files with 11 additions and 0 deletions
|
@ -22,6 +22,9 @@ def parse(data, pnut, mstdn):
|
|||
disposition = part.get_content_disposition()
|
||||
contentType = part.get_content_type()
|
||||
|
||||
logger.debug(disposition)
|
||||
logger.debug(contentType)
|
||||
|
||||
if contentType == "multipart/mixed":
|
||||
continue
|
||||
|
||||
|
@ -40,7 +43,15 @@ def parse(data, pnut, mstdn):
|
|||
else:
|
||||
logger.debug("unknown disposition")
|
||||
logger.debug(disposition)
|
||||
if contentType == "text/plain":
|
||||
body = part.get_payload(decode=True).decode("utf-8")
|
||||
else:
|
||||
logger.error("can't get the message, bailing out")
|
||||
return
|
||||
|
||||
logger.debug(data['Subject'])
|
||||
logger.debug(body)
|
||||
logger.debug(len(attachments))
|
||||
if pnut:
|
||||
post_pnut(data['Subject'], body, attachments)
|
||||
|
||||
|
|
Loading…
Reference in a new issue