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 2024-03-01 18:16:19 +08:00 committed by GitHub
parent cb52b17f92
commit fb42972c05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 48 additions and 43 deletions

View file

@ -105,7 +105,7 @@ func Projects(ctx *context.Context) {
}
for _, project := range projects {
project.RenderedContent = templates.Str2html(project.Description) // FIXME: is it right? why not render?
project.RenderedContent = templates.SanitizeHTML(project.Description) // FIXME: is it right? why not render?
}
err = shared_user.LoadHeaderCount(ctx)
@ -396,7 +396,7 @@ func ViewProject(ctx *context.Context) {
}
}
project.RenderedContent = templates.Str2html(project.Description) // FIXME: is it right? why not render?
project.RenderedContent = templates.SanitizeHTML(project.Description) // FIXME: is it right? why not render?
ctx.Data["LinkedPRs"] = linkedPrsMap
ctx.Data["PageIsViewProjects"] = true
ctx.Data["CanWriteProjects"] = canWriteProjects(ctx)