mirror of https://github.com/milvus-io/milvus.git
enhance: Trim space during parsing string list from string (#35546)
Signed-off-by: Wei Liu <wei.liu@zilliz.com>pull/35579/head
parent
227ecd3901
commit
853d2f33e0
|
@ -23,6 +23,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/cockroachdb/errors"
|
||||
"github.com/samber/lo"
|
||||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
||||
|
@ -286,7 +287,7 @@ func DatabaseLevelResourceGroups(kvs []*commonpb.KeyValuePair) ([]string, error)
|
|||
return nil, invalidPropValue
|
||||
}
|
||||
|
||||
return rgs, nil
|
||||
return lo.Map(rgs, func(rg string, _ int) string { return strings.TrimSpace(rg) }), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,7 +322,7 @@ func CollectionLevelResourceGroups(kvs []*commonpb.KeyValuePair) ([]string, erro
|
|||
return nil, invalidPropValue
|
||||
}
|
||||
|
||||
return rgs, nil
|
||||
return lo.Map(rgs, func(rg string, _ int) string { return strings.TrimSpace(rg) }), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/samber/lo"
|
||||
"go.uber.org/atomic"
|
||||
|
||||
"github.com/milvus-io/milvus/pkg/config"
|
||||
|
@ -335,7 +336,8 @@ func getAsStrings(v string) []string {
|
|||
return []string{}
|
||||
}
|
||||
return getAndConvert(v, func(value string) ([]string, error) {
|
||||
return strings.Split(value, ","), nil
|
||||
ret := strings.Split(value, ",")
|
||||
return lo.Map(ret, func(rg string, _ int) string { return strings.TrimSpace(rg) }), nil
|
||||
}, []string{})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue