all repos — elgit @ 2e58827755e012cd4644cd293238581c466d5167

fork of legit: web frontend for git, written in go

fix incorrect sanitation of HTML tags in non-markdown files

Alin
commit

2e58827755e012cd4644cd293238581c466d5167

parent

071c79f2dbe0ab793ea81551b49628a3c313498b

1 file changed, 1 insertion(+), 5 deletions(-)

changed files
M routes/routes.goroutes/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) } }