From 8d201642c8ffd47abed6b44d742f39780c4d7958 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 18 Oct 2024 12:27:16 +0300 Subject: [PATCH] hicli/html: fix closing font tags in html sanitizer --- pkg/hicli/html.go | 10 +++++++--- pkg/hicli/sync.go | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/hicli/html.go b/pkg/hicli/html.go index b0b7df1..fb66ff0 100644 --- a/pkg/hicli/html.go +++ b/pkg/hicli/html.go @@ -469,9 +469,13 @@ Loop: tagName, _ := tz.TagName() tag := atom.Lookup(tagName) if tagIsAllowed(tag) && ts.pop(tag) { - built.WriteString("') + if tag == atom.Font { + built.WriteString("") + } else { + built.WriteString("') + } } case html.TextToken: if ts.contains(atom.Pre, atom.Code, atom.A) { diff --git a/pkg/hicli/sync.go b/pkg/hicli/sync.go index 2768dc0..f8429a9 100644 --- a/pkg/hicli/sync.go +++ b/pkg/hicli/sync.go @@ -356,7 +356,7 @@ func (h *HiClient) calculateLocalContent(ctx context.Context, dbEvt *database.Ev return nil } -const CurrentHTMLSanitizerVersion = 1 +const CurrentHTMLSanitizerVersion = 2 func (h *HiClient) ReprocessExistingEvent(ctx context.Context, evt *database.Event) { if evt.Type != event.EventMessage.Type || evt.LocalContent == nil || evt.LocalContent.HTMLVersion >= CurrentHTMLSanitizerVersion {