extensions icon indicating copy to clipboard operation
extensions copied to clipboard

fix(firestore-send-email): make attachment validation more lenient and robust

Open cabljac opened this issue 3 weeks ago • 0 comments

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

cabljac avatar Dec 02 '25 13:12 cabljac