set content type
parent
90dbfd6f5a
commit
94a14f8b9d
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue