1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-24 05:17:03 +00:00

asthetics

Former-commit-id: 1b13823e4e31327dad280a82252be969f845efe8
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-06-10 23:37:50 +03:00
parent 05ae7792df
commit 07f678eac0
6 changed files with 127 additions and 68 deletions

View File

@@ -325,16 +325,7 @@ func (r *Route) IsStatic() bool {
// if /assets/{filepath:path} it will return /assets.
func (r *Route) StaticPath() string {
src := r.tmpl.Src
bidx := strings.IndexByte(src, '{')
if bidx == -1 || len(src) <= bidx {
return src // no dynamic part found
}
if bidx <= 1 { // found at first{...} or second index (/{...}),
// although first index should never happen because of the prepended slash.
return "/"
}
return src[:bidx-1] // (/static/{...} -> /static)
return staticPath(src)
}
// ResolvePath returns the formatted path's %v replaced with the args.