Skip to content

v2.9.1

Latest

Choose a tag to compare

@sylvesterdamgaard sylvesterdamgaard released this 04 Sep 09:35

Patch release fixing asset field handling. No breaking changes.

Fixed

Asset field values are round-trip safe (#41)

statamic-entries get returns an assets field the way Statamic stores it — a container-relative path, icons/heart.svg. Everything downstream of a Control Panel form submission expects the other form: the canonical container::path asset ID, in a list. So sending a value straight back into create or update failed:

The page_builder cards icon field must be a file of type: svg.

MimesRule resolves the value with Asset::find(), and a bare path finds nothing. On a field with no file rules it would have got further and then broken in Assets::process(), which calls Asset::findOrFail(). It also hit fields the caller never touched, because update validates incoming data merged with the entry's stored data — all paths.

Incoming asset paths now resolve to canonical IDs before validation, covering nested replicator, bard, grid and group fields as well as top-level ones, across entries, terms and globals.

content_validate no longer flags every valid assets field

The read-side sweep ran the blueprint's rules against stored values, so it reported up to three false errors for a perfectly valid single-file assets field — the mimes failure above, plus "must be an array" and "must not have more than 1 items" from the fieldtype's own rules, which expect a list rather than the bare string Statamic stores. The rule pass now sees bridged references; the structural pass still sees stored values verbatim, so a missing_asset finding keeps quoting what is actually on disk.

content_validate resolves single-container asset fields — a field omitting container where the site has exactly one was skipped by the missing-asset check; it now resolves the same way the fieldtype does.

Notes

Values that resolve to no asset are passed through untouched, so validation reports the real problem rather than silently dropping content. Canonical container::path IDs continue to work unchanged.

Thanks to @florianbouvot for the report.

Full changelog: v2.9.0...v2.9.1