Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(classification): strict identification classification (#11011)

rebelice3075dd336349
diff --git a/backend/common/db_schema.go b/backend/common/db_schema.go
index 37a7d7287e..b3f6f213a4 100644
--- a/backend/common/db_schema.go
+++ b/backend/common/db_schema.go
@@ -5,7 +5,7 @@ import (
"strings"
)
-var getClassificationFromCommentReg = regexp.MustCompile("^[0-9]+(-([0-9])+){0,}")
+var getClassificationFromCommentReg = regexp.MustCompile("^(([0-9]+)-)+")
// GetClassificationAndUserComment parses classification and user comment from the given comment.
func GetClassificationAndUserComment(comment string) (string, string) {
@@ -13,7 +13,8 @@ func GetClassificationAndUserComment(comment string) (string, string) {
if classification == "" {
return "", comment
}
- userComment := strings.TrimPrefix(strings.TrimPrefix(comment, classification), "-")
+ userComment := strings.TrimPrefix(comment, classification)
+ classification = strings.TrimSuffix(classification, "-")
return classification, userComment
}