diff --git a/server/routes.go b/server/routes.go index 39230c9..36f154c 100755 --- a/server/routes.go +++ b/server/routes.go @@ -6,6 +6,7 @@ import ( "local/gziphttp" "local/oauth2/oauth2client" "local/router" + "local/simpleserve/simpleserve" "local/todo-server/config" "log" "net/http" @@ -136,12 +137,14 @@ func (s *Server) _static(w http.ResponseWriter, r *http.Request) error { return err } if info.IsDir() { - f, err = s.fileDir.Open(path.Join(r.URL.Path, "index.html")) + r.URL.Path = path.Join(r.URL.Path, "index.html") + f, err = s.fileDir.Open(r.URL.Path) defer f.Close() if err != nil { return err } } + simpleserve.SetContentTypeIfMedia(w, r) _, err = io.Copy(w, f) return err }