Skip to content

Commit f906fb3

Browse files
Silthusclaude
andcommitted
fix: refuse every unknown attachment key, a None key included
next(..., None) used None as its no-match value, so a None key hid the unknown keys after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 685367c commit f906fb3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎posthog/emails.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,12 @@ def _attachment(index: int, file: Any) -> dict[str, str]:
470470
"Read the file and pass its bytes as content instead.",
471471
f"{field}__path",
472472
)
473-
unknown = next((name for name in file if name not in _ATTACHMENT_FIELDS), None)
474-
if unknown is not None:
473+
unknown = [name for name in file if name not in _ATTACHMENT_FIELDS]
474+
if unknown:
475475
raise _invalid_attachment(
476476
"An attachment takes filename, content, content_type and content_id, "
477-
f"not {unknown}.",
478-
f"{field}__{unknown}",
477+
f"not {unknown[0]}.",
478+
f"{field}__{unknown[0]}",
479479
)
480480
if not isinstance(file.get("filename"), str):
481481
raise _invalid_attachment(

0 commit comments

Comments
 (0)