Repository navigation
explorer 2026.11.18.2
fix(htmlsafe): pre-strip only whole block names (
is not ) (#80)TLDR
Explorer's renderer removed everything from an email's <header>
element up to a later </head>, because its text pre-pass matched block
names by prefix. It now strips a script, style, head, title, meta or
link block only when the tag name is whole, so that content is shown.
Problem
stripBlocks (internal/htmlsafe/sanitize.go) matched preStripNames
with strings.HasPrefix, like the regex it replaced
((?is)<(script|…)[^>]*>.*?</\1>). <header> matched head and the
pass removed through the next </head>; likewise <scripts>,
<styled>, <titles>, <metadata>, <linkx>. Found while matching
the bare-link pass (#79) to the renderer.
Fix
wholeNameAtrequires a space,/or>after the name, as the HTML
tokenizer reads a tag name.- A real
<head ...>block is still stripped; other elements are left
to the tree sanitizer, unchanged. PreStrip, and so the bare-URL download list, follows.
Tests
TestPrePassStripsOnlyWholeBlockNames: header, scripts, metadata and
linkx text is shown (fails on the previous code); a real head block with
attributes is still stripped. go vet, go build, go test ./...
(render golden included) and golangci-lint (0 issues) pass.
What's Changed
Full Changelog: v2026.11.18.1...v2026.11.18.2