fix incorrect sanitation of HTML tags in non-markdown files
1 file changed, 1 insertion(+), 5 deletions(-)
changed files
M routes/routes.go → routes/routes.go
@@ -119,17 +119,13 @@ Content: contents, } if len(pageData.Content) > 0 { - switch filepath.Ext(pageData.Path) { - case ".md": + if filepath.Ext(pageData.Path) == ".md" { unsafe := blackfriday.Run( []byte(pageData.Content), blackfriday.WithExtensions(blackfriday.CommonExtensions), ) html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) pageData.RenderedContent = string(html) - default: - safe := bluemonday.UGCPolicy().SanitizeBytes([]byte(pageData.Content)) - pageData.RenderedContent = fmt.Sprintf(`<pre>%s</pre>`, safe) } }