Skip to content

fix(email): preserve inbound body formatting (WI-2129) - #495

Merged
stefan-ernst merged 1 commit into
mainfrom
fix/wi-2129-email-markdown
Nov 12, 2026
Merged

stefan-ernst merged 1 commit into
mainfrom
fix/wi-2129-email-markdown

Conversation

@stefan-ernst

Copy link
Copy Markdown
Contributor

Summary

  • Normalize inbound HTML into Markdown for ticket descriptions and reply comments, preserving paragraphs, lists, emphasis, safe links, code and simple data tables.
  • Prefer HTML unless it has no visible text, conversion fails, or normalized HTML text is less than 25% of a plain-text alternative containing at least 100 Unicode characters. Compare before signature/quote cleanup.
  • Preserve literal plain-text formatting and line breaks; flatten layout tables and omit images, unsafe links and active HTML. Bound HTML conversion to 1 MiB with a text fallback.
  • Protect code samples from existing signature/reply stripping. Leave system-mail detection, threading, mailbox actions and routing unchanged.

Related: WI-2129; #484. No issue comments were posted.

Tests

Regression tests live in the companion core-tests-internal branch fix/wi-2129-email-markdown. The initial persisted-description and persisted-reply tests failed on the old implementation because emphasis/list formatting was lost; both pass with the fix. Fixtures are synthetic reproductions of the formatting loss, not the original reporter MIME message.

Passed:

  • ../core-tests/overlay.sh . -- -tags=test -count=1 ./internal/email/... ./internal/emailutil/... ./internal/sanitize/...
  • ../core-tests/overlay.sh . -- -tags=test -race -count=1 ./internal/email/... ./internal/emailutil/... ./internal/sanitize/...
  • scripts/run-golangci-lint.sh run --timeout=5m ./internal/email/...
  • Whole-repository Go lint and SQL/audit/layering/handler-DB/deprecated-API guards in the pre-commit hook.
  • go mod tidy -diff and git diff --check.

The first race command exceeded the shell execution limit; the completed race runs passed without changing Go test timeouts. Existing ignored frontend build artifacts were copied into the worktree to satisfy Go embed during whole-repository lint. Full application, PostgreSQL, frontend and browser suites were not run. No frontend source changes or mailbox/plugin changes.

@stefan-ernst
stefan-ernst merged commit 1ac35ae into main Nov 12, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant