WIP: form attachments — unit tests, test e-mail with attachment, lint

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-13 16:28:22 +01:00
co-authored by Claude Fable 5.2
parent 02b1e96d3d
commit 701bb420c1
16 changed files with 302 additions and 35 deletions
@@ -249,11 +249,11 @@ export async function handleFormSubmit(req: PayloadRequest): Promise<Response> {
await pre
}
if (!outcome && gate && stored) {
const missing = (gate as FileGate).end()
const missing = (gate).end()
if (missing) {stop(await fileFailure(payload, (stored as { formId: string }).formId, missing, locale))}
}
// 15. Store the answers and the file metadata, e-mail the files, drop the buffers.
if (!outcome && gate && stored) {stop(await storeSubmission({ ...(stored as Parameters<typeof storeSubmission>[0]), files: (gate as FileGate).accepted }))}
if (!outcome && gate && stored) {stop(await storeSubmission({ ...(stored), files: (gate).accepted }))}
} catch (err) {
payload.logger.error(`[ipal] Form submit failed: ${(err as Error).message}`)
stop({ reason: 'error', success: false })