mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-30 16:42:15 -04:00
Ignore non-string mail CLI recipients (#1824)
This commit is contained in:
@@ -108,6 +108,8 @@ def _q(name: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def _split_recipients(value: str) -> list[str]:
|
def _split_recipients(value: str) -> list[str]:
|
||||||
|
if not isinstance(value, str):
|
||||||
|
return []
|
||||||
return [r.strip() for r in (value or "").split(",") if r.strip()]
|
return [r.strip() for r in (value or "").split(",") if r.strip()]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,3 +48,10 @@ def test_recipient_list_rejects_empty_envelope(monkeypatch):
|
|||||||
assert exc.code == 1
|
assert exc.code == 1
|
||||||
else:
|
else:
|
||||||
raise AssertionError("expected empty recipient list to exit")
|
raise AssertionError("expected empty recipient list to exit")
|
||||||
|
|
||||||
|
|
||||||
|
def test_split_recipients_ignores_non_string_values(monkeypatch):
|
||||||
|
cli = _load_mail_cli(monkeypatch)
|
||||||
|
|
||||||
|
assert cli._split_recipients(None) == []
|
||||||
|
assert cli._split_recipients(["a@example.test"]) == []
|
||||||
|
|||||||
Reference in New Issue
Block a user