Rename Str2html to SanitizeHTML and clarify its behavior (#29516)

Str2html was abused a lot. So use a proper name for it: SanitizeHTML

And add some tests to show its behavior.
This commit is contained in:
wxiaoguang authored and GitHub committed 2024-03-01 10:16:19 +00:00
1 parent cb52b17f92
commit fb42972c05
14 files changed
+48 -43

No files matched your search

+2 -2
View File
@@ -64,7 +64,7 @@ func renderMarkdown(ctx *context.Context, act *activities_model.Action, content
}
markdown, err := markdown.RenderString(markdownCtx, content)
if err != nil {
return templates.Str2html(content) // old code did so: use Str2html to render in tmpl
return templates.SanitizeHTML(content) // old code did so: use SanitizeHTML to render in tmpl
}
return markdown
}
@@ -243,7 +243,7 @@ func feedActionsToFeedItems(ctx *context.Context, actions activities_model.Actio
}
}
if len(content) == 0 {
content = templates.Str2html(desc)
content = templates.SanitizeHTML(desc)
}
items = append(items, &feeds.Item{