1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 21:10:50 +00:00

favicon.ico default deal with static files

This commit is contained in:
astaxie 2013-05-08 16:35:29 +08:00
parent ce77c273cf
commit d6dd84d535

View File

@ -223,6 +223,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
//static file server
for prefix, staticDir := range StaticDir {
if r.URL.Path == "/favicon.ico" {
file := staticDir + r.URL.Path
http.ServeFile(w, r, file)
w.started = true
return
}
if strings.HasPrefix(r.URL.Path, prefix) {
file := staticDir + r.URL.Path[len(prefix):]
http.ServeFile(w, r, file)