From a454c29f3d44b4fc41db450007710f603ff43d59 Mon Sep 17 00:00:00 2001 From: sthuang <167743503+shaoting-huang@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:14:38 +0800 Subject: [PATCH] fix: grant v2 collection name and privilege error typo (#38195) issue: https://github.com/milvus-io/milvus/issues/38042 Signed-off-by: shaoting-huang --- internal/proxy/impl.go | 2 +- internal/proxy/util.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/proxy/impl.go b/internal/proxy/impl.go index be2a32fa441f0..62345664582c3 100644 --- a/internal/proxy/impl.go +++ b/internal/proxy/impl.go @@ -5276,7 +5276,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 a3aadeb433b2f..699c741781fef 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -928,6 +928,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") }