mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-26 09:53:12 +01:00
Merge pull request #680 from auto-mat/email-fix
Don't crash when mail body is empty
This commit is contained in:
commit
eee82015f7
@ -362,11 +362,13 @@ def ticket_from_message(message, queue, logger):
|
|||||||
|
|
||||||
if not body:
|
if not body:
|
||||||
mail = BeautifulSoup(part.get_payload(), "lxml")
|
mail = BeautifulSoup(part.get_payload(), "lxml")
|
||||||
if ">" in mail.text:
|
beautiful_body = mail.find('body')
|
||||||
body = mail.find('body')
|
if beautiful_body:
|
||||||
body = body.text
|
try:
|
||||||
body = body.encode('ascii', errors='ignore')
|
body = beautiful_body.text
|
||||||
else:
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
if not body:
|
||||||
body = mail.text
|
body = mail.text
|
||||||
|
|
||||||
if ticket:
|
if ticket:
|
||||||
|
Loading…
Reference in New Issue
Block a user