Kick name malformed

This commit is contained in:
mr
2026-06-02 10:50:42 +02:00
parent 797df972ac
commit 3924fca289
+4
View File
@@ -3,6 +3,7 @@ package dbs
import ( import (
"fmt" "fmt"
"reflect" "reflect"
"regexp"
"runtime/debug" "runtime/debug"
"strings" "strings"
@@ -239,6 +240,9 @@ func jsonToBsonPaths(t reflect.Type, prefix string) map[string]string {
} }
if ft.Kind() == reflect.Struct { if ft.Kind() == reflect.Struct {
embedPrefix := strings.ToLower(ft.Name()) embedPrefix := strings.ToLower(ft.Name())
re := regexp.MustCompile(`\[[^\]]*\]`)
embedPrefix = re.ReplaceAllString(embedPrefix, "")
embedPrefix = strings.ReplaceAll(embedPrefix, "*", "")
if prefix != "" { if prefix != "" {
embedPrefix = prefix + "." + embedPrefix embedPrefix = prefix + "." + embedPrefix
} }