From 358a25f5ff534c5c56e151bdf7e50272fb41540d Mon Sep 17 00:00:00 2001 From: Xie Zheng Date: Fri, 3 Jan 2025 14:52:55 +0800 Subject: [PATCH] Fix bug which overrides tags.tag when query dlb Search query supports multiple tags.scope and tags.tag, no need to construct a map. --- pkg/clean/clean_dlb.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pkg/clean/clean_dlb.go b/pkg/clean/clean_dlb.go index f29e8ed62..c69639fd3 100644 --- a/pkg/clean/clean_dlb.go +++ b/pkg/clean/clean_dlb.go @@ -37,17 +37,11 @@ func httpQueryDLBResources(cluster *nsx.Cluster, cf *config.NSXOperatorConfig, r "&tags.tag:" + TagDLB pairs := strings.Split(queryParam, "&") - params := make(map[string]string) - for _, pair := range pairs { - kv := strings.Split(pair, ":") - if len(kv) == 2 { - params[kv[0]] = kv[1] - } - } var encodedPairs []string - for key, value := range params { - encodedKey := neturl.QueryEscape(key) - encodedValue := neturl.QueryEscape(value) + for _, pair := range pairs { + keyValue := strings.Split(pair, ":") + encodedKey := neturl.QueryEscape(keyValue[0]) + encodedValue := neturl.QueryEscape(keyValue[1]) encodedPairs = append(encodedPairs, fmt.Sprintf("%s:%s", encodedKey, encodedValue)) }