handle case catch_all is enabled but custom_domain.auto_create_regex is already set

This commit is contained in:
Son Nguyen Kim 2021-09-20 12:32:39 +02:00
parent 0aa3dff38b
commit 005a760710
1 changed files with 1 additions and 2 deletions

View File

@ -132,11 +132,10 @@ def try_auto_create_catch_all_domain(address: str) -> Optional[Alias]:
if not custom_domain:
return None
# custom_domain exists
if not custom_domain.catch_all and not custom_domain.auto_create_regex:
return None
if custom_domain.auto_create_regex:
if custom_domain.auto_create_regex and not custom_domain.catch_all:
local = get_email_local_part(address)
regex = re.compile(custom_domain.auto_create_regex)
if not re.fullmatch(regex, local):