mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 02:31:04 +01:00
minor
This commit is contained in:
parent
e98c21d1c5
commit
1e5cbf9e24
|
@ -16,7 +16,7 @@ func init() {
|
|||
}
|
||||
|
||||
if setting.Key == "vcs.time" {
|
||||
BuildTime = setting.Key
|
||||
BuildTime = setting.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ func convertMacroTmplToNodePath(tmpl macro.Template) string {
|
|||
// if it has started with {} and it's valid
|
||||
// then the tmpl.Params will be filled,
|
||||
// so no any further check needed.
|
||||
for _, p := range tmpl.Params {
|
||||
for i := range tmpl.Params {
|
||||
p := tmpl.Params[i]
|
||||
if ast.IsTrailing(p.Type) {
|
||||
routePath = strings.Replace(routePath, p.Src, WildcardParam(p.Name), 1)
|
||||
} else {
|
||||
|
|
|
@ -36,7 +36,8 @@ func CanMakeHandler(tmpl macro.Template) (needsMacroHandler bool) {
|
|||
// check if we have params like: {name:string} or {name} or {anything:path} without else keyword or any functions used inside these params.
|
||||
// 1. if we don't have, then we don't need to add a handler before the main route's handler (as I said, no performance if macro is not really used)
|
||||
// 2. if we don't have any named params then we don't need a handler too.
|
||||
for _, p := range tmpl.Params {
|
||||
for i := range tmpl.Params {
|
||||
p := tmpl.Params[i]
|
||||
if p.CanEval() {
|
||||
// if at least one needs it, then create the handler.
|
||||
needsMacroHandler = true
|
||||
|
@ -85,7 +86,8 @@ func MakeFilter(tmpl macro.Template) context.Filter {
|
|||
}
|
||||
|
||||
return func(ctx *context.Context) bool {
|
||||
for _, p := range tmpl.Params {
|
||||
for i := range tmpl.Params {
|
||||
p := tmpl.Params[i]
|
||||
if !p.CanEval() {
|
||||
continue // allow.
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user