fix: use bluemonday as recommended by blackfriday (#2142)

use bluemonday as recommended by blackfriday

Signed-off-by: Dave Lee <dave@gray101.com>
This commit is contained in:
Dave
2024-04-26 04:34:50 -04:00
committed by GitHub
parent 2cd4936c99
commit 006306b183
3 changed files with 17 additions and 6 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ import (
"github.com/go-skynet/LocalAI/core/schema"
"github.com/gofiber/fiber/v2"
fiberhtml "github.com/gofiber/template/html/v2"
"github.com/microcosm-cc/bluemonday"
"github.com/russross/blackfriday"
)
@@ -39,5 +40,5 @@ func renderEngine() *fiberhtml.Engine {
func markDowner(args ...interface{}) template.HTML {
s := blackfriday.MarkdownCommon([]byte(fmt.Sprintf("%s", args...)))
return template.HTML(s)
return template.HTML(bluemonday.UGCPolicy().Sanitize(string(s)))
}