mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
email-mirror-postfix: Handle 8-bit messages correctly.
Since JSON can’t represent bytes, we encode them with base64. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
bff3dcadc8
commit
a803e68528
@@ -421,8 +421,7 @@ def validate_to_address(rcpt_to: str) -> None:
|
||||
else:
|
||||
decode_stream_email_address(rcpt_to)
|
||||
|
||||
def mirror_email_message(data: Dict[str, str]) -> Dict[str, str]:
|
||||
rcpt_to = data['recipient']
|
||||
def mirror_email_message(rcpt_to: str, msg_base64: str) -> Dict[str, str]:
|
||||
try:
|
||||
validate_to_address(rcpt_to)
|
||||
except ZulipEmailForwardError as e:
|
||||
@@ -434,8 +433,8 @@ def mirror_email_message(data: Dict[str, str]) -> Dict[str, str]:
|
||||
queue_json_publish(
|
||||
"email_mirror",
|
||||
{
|
||||
"message": data['msg_text'],
|
||||
"rcpt_to": rcpt_to,
|
||||
"msg_base64": msg_base64,
|
||||
},
|
||||
)
|
||||
return {"status": "success"}
|
||||
|
||||
Reference in New Issue
Block a user