File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 66 "bytes"
77 "fmt"
88 "strings"
9+
10+ "github.com/microcosm-cc/bluemonday"
911)
1012
1113const (
@@ -148,7 +150,11 @@ func InsertDoctype(htmldata []byte) []byte {
148150 return htmldata
149151}
150152
151- // NoPage provides the same functionality as NoPage, but returns []byte
153+ // NoPage generates a HTML page for when a file is not found
152154func NoPage (filename , theme string ) []byte {
153- return MessagePageBytes ("Not found" , []byte ("File not found: " + filename ), theme )
155+ // Sanitize the filename
156+ policy := bluemonday .UGCPolicy ()
157+ sanitizedFilename := policy .Sanitize (filename )
158+ // Return a HTML page
159+ return MessagePageBytes ("Not found" , []byte ("File not found: " + sanitizedFilename ), theme )
154160}
You can’t perform that action at this time.
0 commit comments