diff --git a/pkg/api/search_filters_parsers.go b/pkg/api/search_filters_parsers.go index 1990604..3a9841e 100644 --- a/pkg/api/search_filters_parsers.go +++ b/pkg/api/search_filters_parsers.go @@ -1,6 +1,7 @@ package api import ( + "fmt" "strconv" "strings" ) @@ -62,10 +63,15 @@ func parseExtCommunityValue(value string) (*SearchFilter, error) { components := strings.Split(value, ":") community := make(ExtCommunity, len(components)) - for i, c := range components { - community[i] = c + if len(community) != 3 { + return nil, fmt.Errorf("malformed ext. community: %s", value) } + // Communities are not stringly typed, but a mix of string and int + community[0] = components[0] + community[1], _ = strconv.Atoi(components[1]) + community[2], _ = strconv.Atoi(components[2]) + return &SearchFilter{ Name: community.String(), Value: community,