Skip to content

Commit c28d620

Browse files
ivanmatmatioktalz
authored andcommitted
MINOR: avoid extra space in custom route
1 parent ca1325b commit c28d620

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pkg/route/route.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,17 @@ func AddCustomRoute(route Route, routeACLAnn string, api api.HAProxyClient) (err
108108
}
109109
if route.Path.Path != "" {
110110
if route.Path.PathTypeMatch == store.PATH_TYPE_EXACT {
111-
routeCond = fmt.Sprintf("%s { path %s } ", routeCond, route.Path.Path)
111+
if routeCond == "" {
112+
routeCond = fmt.Sprintf("{ path %s }", route.Path.Path)
113+
} else {
114+
routeCond = fmt.Sprintf("%s { path %s }", routeCond, route.Path.Path)
115+
}
112116
} else {
113-
routeCond = fmt.Sprintf("%s { path -m beg %s } ", routeCond, route.Path.Path)
117+
if routeCond == "" {
118+
routeCond = fmt.Sprintf("{ path -m beg %s }", route.Path.Path)
119+
} else {
120+
routeCond = fmt.Sprintf("%s { path -m beg %s }", routeCond, route.Path.Path)
121+
}
114122
}
115123
}
116124
routeCond = fmt.Sprintf("%s { %s } ", routeCond, routeACLAnn)

0 commit comments

Comments
 (0)