extensions
extensions copied to clipboard
fix(firestore-send-email): make attachment validation more lenient and robust
Fixes #2550 - Email delivery failing with "Expected array, received object" Zod validation error.
The attachmentsSchema now uses z.preprocess() to normalize attachment inputs before validation:
- Single attachment objects are automatically wrapped in an array
- null values are treated as "no attachments"
- Empty attachment objects are filtered out
Also replaced direct .parse() calls with .safeParse() for better error handling.
Test plan
- Existing tests updated to reflect new lenient behavior
- Added test for single attachment object normalization
- All validation and prepare-payload tests pass