1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-26 02:57:04 +00:00

setting an alias to forward to two or more addresses was broken since aa33428311

fixes #482
This commit is contained in:
Joshua Tauberer 2015-07-04 15:25:56 +00:00
parent b503ea1cf7
commit acd91665b5

View File

@ -55,9 +55,11 @@ def sanitize_idn_email_address(email):
localpart, domainpart = email.split("@") localpart, domainpart = email.split("@")
domainpart = idna.encode(domainpart).decode('ascii') domainpart = idna.encode(domainpart).decode('ascii')
return localpart + "@" + domainpart return localpart + "@" + domainpart
except idna.IDNAError: except (ValueError, idna.IDNAError):
# Domain part is not IDNA-valid, so leave unchanged. If there # ValueError: String does not have a single @-sign, so it is not
# are non-ASCII characters it will be filtered out by # a valid email address. IDNAError: Domain part is not IDNA-valid.
# Validation is not this function's job, so return value unchanged.
# If there are non-ASCII characters it will be filtered out by
# validate_email. # validate_email.
return email return email
@ -68,8 +70,9 @@ def prettify_idn_email_address(email):
localpart, domainpart = email.split("@") localpart, domainpart = email.split("@")
domainpart = idna.decode(domainpart.encode("ascii")) domainpart = idna.decode(domainpart.encode("ascii"))
return localpart + "@" + domainpart return localpart + "@" + domainpart
except (UnicodeError, idna.IDNAError): except (ValueError, UnicodeError, idna.IDNAError):
# Failed to decode IDNA. Should never happen. # Failed to decode IDNA, or the email address does not have a
# single @-sign. Should never happen.
return email return email
def is_dcv_address(email): def is_dcv_address(email):