mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
email_mirror: Fail more gracefully on empty EMAIL_GATEWAY_PATTERN.
Otherwise, this fails on `match.group(1)` as there is no match group. The server would ideally respond with a 521 or 556 code[^1] on initial connection, but aiosmtpd does not provide that option. [^1]: https://www.rfc-editor.org/rfc/rfc7504
This commit is contained in:
committed by
Tim Abbott
parent
43a7035745
commit
8cde0af040
@@ -33,6 +33,8 @@ class ZulipEmailForwardUserError(ZulipEmailForwardError):
|
||||
|
||||
|
||||
def get_email_gateway_message_string_from_address(address: str) -> str:
|
||||
if settings.EMAIL_GATEWAY_PATTERN == "":
|
||||
raise ZulipEmailForwardError("This server is not configured for incoming email.")
|
||||
pattern_parts = [re.escape(part) for part in settings.EMAIL_GATEWAY_PATTERN.split("%s")]
|
||||
if settings.EMAIL_GATEWAY_EXTRA_PATTERN_HACK:
|
||||
# Accept mails delivered to any Zulip server
|
||||
|
||||
Reference in New Issue
Block a user