fix: decode before format to json (#10506)
### What problem does this PR solve? Decode bytes before format to json. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
acca3640f7
commit
7fb8b30cc2
1 changed files with 2 additions and 2 deletions
|
|
@ -411,7 +411,7 @@ class Parser(ProcessBase):
|
||||||
dispositions = content_disposition.strip().split(";")
|
dispositions = content_disposition.strip().split(";")
|
||||||
if dispositions[0].lower() == "attachment":
|
if dispositions[0].lower() == "attachment":
|
||||||
filename = part.get_filename()
|
filename = part.get_filename()
|
||||||
payload = part.get_payload(decode=True)
|
payload = part.get_payload(decode=True).decode(part.get_content_charset())
|
||||||
attachments.append({
|
attachments.append({
|
||||||
"filename": filename,
|
"filename": filename,
|
||||||
"payload": payload,
|
"payload": payload,
|
||||||
|
|
@ -448,7 +448,7 @@ class Parser(ProcessBase):
|
||||||
for t in msg.attachments:
|
for t in msg.attachments:
|
||||||
attachments.append({
|
attachments.append({
|
||||||
"filename": t.name,
|
"filename": t.name,
|
||||||
"payload": t.data # binary
|
"payload": t.data.decode("utf-8")
|
||||||
})
|
})
|
||||||
email_content["attachments"] = attachments
|
email_content["attachments"] = attachments
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue