mirror of
https://github.com/containous/traefik.git
synced 2025-01-07 17:17:53 +03:00
fix: invalid label/flag parsing.
This commit is contained in:
parent
4d0aee67be
commit
8930236396
@ -21,6 +21,10 @@ func DecodeToNode(labels map[string]string, rootName string, filters ...string)
|
||||
|
||||
var parts []string
|
||||
for _, v := range split {
|
||||
if v == "" {
|
||||
return nil, fmt.Errorf("invalid element: %s", key)
|
||||
}
|
||||
|
||||
if v[0] == '[' {
|
||||
return nil, fmt.Errorf("invalid leading character '[' in field name (bracket is a slice delimiter): %s", v)
|
||||
}
|
||||
|
@ -26,6 +26,15 @@ func TestDecodeToNode(t *testing.T) {
|
||||
in: map[string]string{},
|
||||
expected: expected{node: nil},
|
||||
},
|
||||
{
|
||||
desc: "invalid label, ending by a dot",
|
||||
in: map[string]string{
|
||||
"traefik.http.": "bar",
|
||||
},
|
||||
expected: expected{
|
||||
error: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "level 1",
|
||||
in: map[string]string{
|
||||
|
Loading…
Reference in New Issue
Block a user