fix(post-form): convert HEIC via FilePond beforeAddFile, not a custom uploader (U4)

Runtime verification showed the custom picker uploaded to Grav's flash but
never attached photos to the entry — attachment needs FilePond's exact
(undocumented) submit contract. Reverting to type:filepond and hooking its
beforeAddFile: a HEIC item is rejected, converted to JPEG via the lazy heic-to
chunk, then re-added with pond.addFile() so FilePond owns upload + page-attach
(the proven path). Web-format photos pass through; conversion failures fail
closed (inline status, original never added). Removes the custom photos field
template + AJAX uploader.

Verified end-to-end in a browser: HEIC posts as JPEG, corrupt HEIC is skipped,
Submit gated while converting, draft photos-reselect hint intact.

Refs R8, R9, R16, R17, AE1, AE4, KTD4.
This commit is contained in:
2026-07-04 17:51:58 +02:00
parent 9a96d0f19e
commit c70e96879b
6 changed files with 162 additions and 266 deletions
+5 -5
View File
@@ -47,11 +47,11 @@ form:
-
name: photos
label: Photos (max 4)
# Custom controlled picker (theme: forms/fields/photos) — replaces
# filepond so post-form.js can convert HEIC before upload (U4). The
# destination/accept/limit below are still read server-side by the
# form's AJAX uploadFiles() handler.
type: photos
# Grav-managed filepond field. post-form.js hooks its beforeAddFile
# to convert HEIC->JPEG in the browser, then re-adds the JPEG via the
# public pond.addFile() API — FilePond keeps ownership of the upload
# and page-attach contract (U4).
type: filepond
multiple: true
destination: '@self'
limit: 4