Do not show an error if we receive an unsubscribe from a different address
This commit is contained in:
parent
42f89b71d7
commit
7649f6b822
|
@ -1450,6 +1450,7 @@ def save_envelope_for_debugging(envelope: Envelope, file_name_prefix=None) -> st
|
||||||
"""Save envelope for debugging to temporary location
|
"""Save envelope for debugging to temporary location
|
||||||
Return the file path
|
Return the file path
|
||||||
"""
|
"""
|
||||||
|
LOG.d("TE {}".format( TEMP_DIR))
|
||||||
if TEMP_DIR:
|
if TEMP_DIR:
|
||||||
file_name = str(uuid.uuid4()) + ".eml"
|
file_name = str(uuid.uuid4()) + ".eml"
|
||||||
if file_name_prefix:
|
if file_name_prefix:
|
||||||
|
|
|
@ -2083,7 +2083,7 @@ def handle_unsubscribe_user(user_id: int, mail_from: str) -> str:
|
||||||
return status.E510
|
return status.E510
|
||||||
|
|
||||||
if mail_from != user.email:
|
if mail_from != user.email:
|
||||||
LOG.e("Unauthorized mail_from %s %s", user, mail_from)
|
LOG.w("Unauthorized mail_from %s %s", user, mail_from)
|
||||||
return status.E511
|
return status.E511
|
||||||
|
|
||||||
user.notification = False
|
user.notification = False
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[pytest]
|
[pytest]
|
||||||
addopts =
|
xaddopts =
|
||||||
--cov
|
--cov
|
||||||
--cov-config coverage.ini
|
--cov-config coverage.ini
|
||||||
--cov-report=html:htmlcov
|
--cov-report=html:htmlcov
|
||||||
|
|
|
@ -159,3 +159,12 @@ def test_preserve_5xx_with_no_header(flask_client):
|
||||||
envelope.rcpt_tos = [msg["to"]]
|
envelope.rcpt_tos = [msg["to"]]
|
||||||
result = email_handler.MailHandler()._handle(envelope, msg)
|
result = email_handler.MailHandler()._handle(envelope, msg)
|
||||||
assert result == status.E512
|
assert result == status.E512
|
||||||
|
|
||||||
|
def test_lol():
|
||||||
|
msg = load_eml_file("KeyErrorbf6219c1-3bed-419f-ae40-bec264204e2d.eml")
|
||||||
|
msg.as_string()
|
||||||
|
envelope = Envelope()
|
||||||
|
envelope.mail_from = msg[headers.FROM]
|
||||||
|
envelope.rcpt_tos = [msg["to"]]
|
||||||
|
envelope.original_content = msg.as_string()
|
||||||
|
result = email_handler.MailHandler()._handle(envelope, msg)
|
||||||
|
|
Loading…
Reference in a new issue