all repos — legit @ ec84ea1c0b363da438d5e8e3ec3c9a3d20ffb060

web frontend for git, written in go

routes: sanitize readme content for non markdown files

Anirudh Oppiliappan
commit

ec84ea1c0b363da438d5e8e3ec3c9a3d20ffb060

parent

98546565dfa755607222b8df87ddffcaf2ed14a3

1 file changed, 2 insertions(+), 1 deletion(-)

jump to
M routes/routes.goroutes/routes.go
@@ -121,8 +121,9 @@ )
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) readmeContent = template.HTML(html) default: + safe := bluemonday.UGCPolicy().SanitizeBytes([]byte(content)) readmeContent = template.HTML( - fmt.Sprintf(`<pre>%s</pre>`, content), + fmt.Sprintf(`<pre>%s</pre>`, safe), ) } break