Files
summercms/.planning/todos/done/journal-imported-html-admin-resave.md
Jakub Zych 3f9d3b4f11 docs: sync todos with g15office and map phases to milestone tasks
Tag the 17 open todos with their g15office task IDs, close 7 todos that
are already done or promoted to Phase 16.3, and record the sync rules
and the phase-to-task map in .planning/G15OFFICE.md.
2026-10-11 02:01:50 +02:00

1.6 KiB

title, date, priority, area, status, closed
title date priority area status closed
Keep imported HTML post bodies intact when a Journal post is re-saved in the admin 2026-10-09 high sm-journal-plugin done 2026-10-11

Phase 16 RESEARCH Pitfall 2. The PHP journal export carries the pl post content as HTML (61 of 63 published posts on grzybyfunkcjonalne.pl). journal:import-posts stores it as is and the pl content_html is correct, so imported posts render fine. But an admin save of such a post runs FormatHTML(content): goldmark without html.WithUnsafe() replaces raw HTML with <!-- raw HTML omitted -->, so the post body is wiped (probe in 16-RESEARCH.md: pl HTML content -> out="<!-- raw HTML omitted -->\n").

Until this is fixed, do not edit imported posts in /gfadmin (the sm-grzybyfunkcjonalne-app README repeats the warning).

Fix in sm-journal-plugin, one of:

  • convert HTML content to markdown at import (an HTML-to-markdown step in journal:import-posts), or
  • pass raw HTML through on save when the stored content is HTML (detect it, keep the three-pattern CheckHTML gate, skip goldmark), or
  • add a content format flag on the post so HTML-sourced posts are edited as HTML.

Whatever the fix, it must keep the XSS gate (classes.CheckHTML) on every write path and keep the PHP API contract of content/content_html unchanged. Add a test that re-saves an imported HTML post and asserts content_html is unchanged.

Closed 2026-10-11

Done in Phase 16.2 (D-03): FormatHTML passes raw HTML through (html.WithUnsafe()), covered by TestFormatHTMLKeepsRawHTML and the posts admin smoke test.