Description
In the new Edit Content, opening the image editor from a Binary field whose value was hydrated from a saved contentlet renders a broken preview ("We couldn't render the preview. Please try again."), and saving from that state stages a temp file with unusable metadata (the preview then falls back to the type icon instead of the edited image).
Root cause
DotFileFieldComponent.onEditImage() resolves the field variable for the editor URLs as:
const editorVariable =
uploaded?.source === 'contentlet'
? String(uploaded.file['titleImage'] ?? variable)
: variable;
For a Binary field on a saved contentlet, the store hydrates the preview with the parent contentlet (setFileFromContentlet), so uploaded.file is the parent and its titleImage points at the content type's first image-ish field — which can be an Image reference field (stores a dotAsset identifier, holds no binary). The editor then requests /contentAsset/image/{parentInode}/{titleImage}/... and gets a 404.
The titleImage fallback is only correct for standalone assets (dotAsset via getAssetData, AI-generated images), where the image does live in the asset's own titleImage field.
Steps to reproduce
- Content type with an Image (reference) field ordered before a Binary field (e.g. the QA type:
image, ..., binaryImage).
- Save a contentlet with both fields populated.
- Reopen it in the new Edit Content and click the Binary field's Edit (pencil) action.
- The editor preview fails to render; requests to
/contentAsset/image/{inode}/image?... return 404. Saving from that state degrades the preview thumbnail to the type icon.
Proposed fix
Prefer the field variable the store already injects when hydrating from the parent contentlet, falling back to titleImage only for standalone assets (which carry no injected fieldVariable):
const editorVariable =
uploaded?.source === 'contentlet'
? String(uploaded.file['fieldVariable'] ?? uploaded.file['titleImage'] ?? variable)
: variable;
Verified live: Binary editor preview renders and the save round-trip applies the edit; Image/File fields (dotAsset, no injected fieldVariable) keep the titleImage resolution and are unaffected.
Priority
Medium
Additional Context
Description
In the new Edit Content, opening the image editor from a Binary field whose value was hydrated from a saved contentlet renders a broken preview ("We couldn't render the preview. Please try again."), and saving from that state stages a temp file with unusable metadata (the preview then falls back to the type icon instead of the edited image).
Root cause
DotFileFieldComponent.onEditImage()resolves the field variable for the editor URLs as:For a Binary field on a saved contentlet, the store hydrates the preview with the parent contentlet (
setFileFromContentlet), souploaded.fileis the parent and itstitleImagepoints at the content type's first image-ish field — which can be an Image reference field (stores a dotAsset identifier, holds no binary). The editor then requests/contentAsset/image/{parentInode}/{titleImage}/...and gets a 404.The
titleImagefallback is only correct for standalone assets (dotAsset viagetAssetData, AI-generated images), where the image does live in the asset's owntitleImagefield.Steps to reproduce
image, ...,binaryImage)./contentAsset/image/{inode}/image?...return 404. Saving from that state degrades the preview thumbnail to the type icon.Proposed fix
Prefer the field variable the store already injects when hydrating from the parent contentlet, falling back to
titleImageonly for standalone assets (which carry no injectedfieldVariable):Verified live: Binary editor preview renders and the save round-trip applies the edit; Image/File fields (dotAsset, no injected
fieldVariable) keep thetitleImageresolution and are unaffected.Priority
Medium
Additional Context
libs/edit-content).