Fixed static file embedding

This commit is contained in:
2025-02-16 17:57:27 +11:00
parent f9e17211ce
commit fafb9b436f
7 changed files with 34 additions and 53 deletions

View File

@@ -42,10 +42,10 @@ func (f neuteredReaddirFile) Readdir(count int) ([]os.FileInfo, error) {
// Handles requests for static files, without allowing access to the
// directory viewer and returning 404 if an exact file is not found
func HandleStatic() http.Handler {
func HandleStatic(staticFS *http.FileSystem) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
nfs := justFilesFilesystem{http.Dir("static")}
nfs := justFilesFilesystem{*staticFS}
fs := http.FileServer(nfs)
fs.ServeHTTP(w, r)
},