Skip to content

Commit

Permalink
fix: grant v2 collection name and privilege error typo (milvus-io#38195)
Browse files Browse the repository at this point in the history
issue: milvus-io#38042

Signed-off-by: shaoting-huang <[email protected]>
  • Loading branch information
shaoting-huang authored Dec 4, 2024
1 parent 262f6db commit a65d395
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/proxy/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions internal/proxy/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/merr/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "->"))
}
Expand Down

0 comments on commit a65d395

Please sign in to comment.