proxy/router: fix panic & gofmt

pull/111/head v2.0.0
jsign 2019-08-29 18:11:31 -03:00 committed by kun
parent a7bbe9e74f
commit 5aa10edcd3
2 changed files with 21 additions and 16 deletions

View File

@ -107,6 +107,11 @@ func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var ctype string var ctype string
defer f.Close() defer f.Close()
i := strings.Index(r.URL.Path, "/@v/") i := strings.Index(r.URL.Path, "/@v/")
if i < 0 {
http.Error(w, "no such path", http.StatusNotFound)
return
}
what := r.URL.Path[i+len("/@v/"):] what := r.URL.Path[i+len("/@v/"):]
if what == "list" { if what == "list" {
if time.Since(info.ModTime()) >= ListExpire { if time.Since(info.ModTime()) >= ListExpire {