From 872e73077e031fa27416260f7937c30634b85c06 Mon Sep 17 00:00:00 2001 From: Sven Date: Mon, 27 Apr 2026 09:29:20 +0200 Subject: [PATCH] fix: use `is string` not `is mapping` in content-field fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `is mapping` is Jinja2-only — Nunjucks doesn't have it, so the test always evaluated false, falling through to the raw content object and rendering as [object Object]. Fix: `_contentFv.text or (_contentFv if _contentFv is string else "")` correctly handles both object fallback (extracts .text) and string fallback (validation re-render). Co-Authored-By: Claude Sonnet 4.6 --- scripts/patch-endpoint-posts-content-field-object.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/patch-endpoint-posts-content-field-object.mjs b/scripts/patch-endpoint-posts-content-field-object.mjs index 37bc02c3..c1c634d7 100644 --- a/scripts/patch-endpoint-posts-content-field-object.mjs +++ b/scripts/patch-endpoint-posts-content-field-object.mjs @@ -24,7 +24,7 @@ const newSnippet = `{#- ${marker} -#} {%- set _contentFv = fieldData("content").value -%} {{ textarea({ name: "content", - value: properties.content.text or (_contentFv.text if _contentFv is mapping else _contentFv) or "",`; + value: properties.content.text or _contentFv.text or (_contentFv if _contentFv is string else ""),`; async function exists(p) { try { await access(p); return true; } catch { return false; }