Skip to content

Commit 7e91e0d

Browse files
fix: Potential fix for code scanning alert no. 2: Reflected cross-site scripting
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 6ec88f1 commit 7e91e0d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/net/http/fs.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"io/fs"
1313
"net/http"
1414
"net/url"
15+
"html"
1516
"path"
1617
"path/filepath"
1718
"sort"
@@ -241,7 +242,7 @@ func dirList(w http.ResponseWriter, r *http.Request, f http.File) {
241242
timeformat = app.AutoIndexTimeFormat
242243
}
243244

244-
title := fmt.Sprintf("Index of %s", r.URL)
245+
title := fmt.Sprintf("Index of %s", html.EscapeString(r.URL.String()))
245246

246247
w.Header().Set("Content-Type", "text/html; charset=utf-8")
247248

0 commit comments

Comments
 (0)