fix bug for static file like /static /static_js /static_css
Showing
1 changed file
with
8 additions
and
3 deletions
| ... | @@ -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 { | ... | ... |
-
Please register or sign in to post a comment