diff --git a/router/subrouter.go b/router/subrouter.go index fdf642a..5e55f56 100644 --- a/router/subrouter.go +++ b/router/subrouter.go @@ -98,7 +98,8 @@ func (sr *SubRouter) Group(path string, fn func(*Group)) { } func (sr *SubRouter) ServeFiles(path string, fs http.FileSystem) error { - const suffix = "/:filepath" + const param = "filepath" + const suffix = "/:" + param if len(path) < 10 || path[len(path)-10:] != suffix { return errors.New("path must end with "+suffix, "path", path) ////////////////////////////////////////////////// @@ -107,7 +108,7 @@ func (sr *SubRouter) ServeFiles(path string, fs http.FileSystem) error { fileServer := http.FileServer(fs) sr.Get(path, func(c *context.Context) error { - c.Request.URL.Path = c.Param("filepath") + c.Request.URL.Path = c.Param(param) fileServer.ServeHTTP(c.Response, c.Request) return nil