all repos — legit @ ec84ea1c0b363da438d5e8e3ec3c9a3d20ffb060

web frontend for git, written in go

routes: sanitize readme content for non markdown files
Anirudh Oppiliappan x@icyphox.sh
Thu, 16 Jan 2025 11:39:54 +0200
commit

ec84ea1c0b363da438d5e8e3ec3c9a3d20ffb060

parent

98546565dfa755607222b8df87ddffcaf2ed14a3

1 files changed, 2 insertions(+), 1 deletions(-)

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