This commit is contained in:
Gerasimos (Makis) Maropoulos 2022-04-18 10:52:47 +03:00
parent e98c21d1c5
commit 1e5cbf9e24
No known key found for this signature in database
GPG Key ID: 66FCC29BD385FCA6
3 changed files with 7 additions and 4 deletions

View File

@ -16,7 +16,7 @@ func init() {
}
if setting.Key == "vcs.time" {
BuildTime = setting.Key
BuildTime = setting.Value
}
}
}

View File

@ -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 {

View File

@ -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.
}