6c92ca2a by asta.xie

fix bug for static file like /static /static_js /static_css

1 parent 217c3a2e
...@@ -548,11 +548,16 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -548,11 +548,16 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
548 for prefix, staticDir := range StaticDir { 548 for prefix, staticDir := range StaticDir {
549 if r.URL.Path == "/favicon.ico" { 549 if r.URL.Path == "/favicon.ico" {
550 file := path.Join(staticDir, r.URL.Path) 550 file := path.Join(staticDir, r.URL.Path)
551 http.ServeFile(w, r, file) 551 if utils.FileExists(file) {
552 w.started = true 552 http.ServeFile(w, r, file)
553 goto Admin 553 w.started = true
554 goto Admin
555 }
554 } 556 }
555 if strings.HasPrefix(r.URL.Path, prefix) { 557 if strings.HasPrefix(r.URL.Path, prefix) {
558 if len(r.URL.Path) > len(prefix) && r.URL.Path[len(prefix)+1] != '/' {
559 continue
560 }
556 file := path.Join(staticDir, r.URL.Path[len(prefix):]) 561 file := path.Join(staticDir, r.URL.Path[len(prefix):])
557 finfo, err := os.Stat(file) 562 finfo, err := os.Stat(file)
558 if err != nil { 563 if err != nil {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!