Fixed static file embedding
This commit is contained in:
@@ -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)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user