From 5de6f658d00575d13625a10e227e4505a535f99b Mon Sep 17 00:00:00 2001 From: shaoting-huang Date: Wed, 4 Dec 2024 10:24:58 +0800 Subject: [PATCH] fix collection name and privilege error typo Signed-off-by: shaoting-huang --- internal/proxy/impl.go | 2 +- internal/proxy/util.go | 7 +++++++ pkg/util/merr/utils.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/proxy/impl.go b/internal/proxy/impl.go index da06cf4d4abdc..dae27e347c97c 100644 --- a/internal/proxy/impl.go +++ b/internal/proxy/impl.go @@ -5365,7 +5365,7 @@ func (node *Proxy) validateOperatePrivilegeV2Params(req *milvuspb.OperatePrivile return err } } - if err := ValidateObjectName(req.CollectionName); err != nil { + if err := ValidateCollectionName(req.CollectionName); err != nil { return err } return nil diff --git a/internal/proxy/util.go b/internal/proxy/util.go index 1bf7d0fbb546d..5a14b97f5dc4f 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -1102,6 +1102,13 @@ func ValidateObjectName(entity string) error { return validateName(entity, "object name") } +func ValidateCollectionName(entity string) error { + if util.IsAnyWord(entity) { + return nil + } + return validateName(entity, "collection name") +} + func ValidateObjectType(entity string) error { return validateName(entity, "ObjectType") } diff --git a/pkg/util/merr/utils.go b/pkg/util/merr/utils.go index bf3caad93e6e4..3cf0d888458b6 100644 --- a/pkg/util/merr/utils.go +++ b/pkg/util/merr/utils.go @@ -461,7 +461,7 @@ func WrapErrDatabaseNameInvalid(database any, msg ...string) error { } func WrapErrPrivilegeGroupNameInvalid(privilegeGroup any, msg ...string) error { - err := wrapFields(ErrPrivilegeGroupInvalidName, value("privielgeGroup", privilegeGroup)) + err := wrapFields(ErrPrivilegeGroupInvalidName, value("privilegeGroup", privilegeGroup)) if len(msg) > 0 { err = errors.Wrap(err, strings.Join(msg, "->")) }