Skip to content

Commit

Permalink
MINOR: avoid extra space in custom route
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmatmati authored and oktalz committed Nov 21, 2024
1 parent ca1325b commit c28d620
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,17 @@ func AddCustomRoute(route Route, routeACLAnn string, api api.HAProxyClient) (err
}
if route.Path.Path != "" {
if route.Path.PathTypeMatch == store.PATH_TYPE_EXACT {
routeCond = fmt.Sprintf("%s { path %s } ", routeCond, route.Path.Path)
if routeCond == "" {
routeCond = fmt.Sprintf("{ path %s }", route.Path.Path)
} else {
routeCond = fmt.Sprintf("%s { path %s }", routeCond, route.Path.Path)
}
} else {
routeCond = fmt.Sprintf("%s { path -m beg %s } ", routeCond, route.Path.Path)
if routeCond == "" {
routeCond = fmt.Sprintf("{ path -m beg %s }", route.Path.Path)
} else {
routeCond = fmt.Sprintf("%s { path -m beg %s }", routeCond, route.Path.Path)
}
}
}
routeCond = fmt.Sprintf("%s { %s } ", routeCond, routeACLAnn)
Expand Down

0 comments on commit c28d620

Please sign in to comment.