mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #12544 from rainzm/notify/generate_name
fix(notify): be compatible with Chinese when generating names
This commit is contained in:
@@ -151,10 +151,11 @@ func (nm *SNotificationManager) ValidateCreateData(ctx context.Context, userCred
|
||||
}
|
||||
// hack
|
||||
length := 10
|
||||
if len(input.Topic) < 10 {
|
||||
length = len(input.Topic)
|
||||
topicRunes := []rune(input.Topic)
|
||||
if len(topicRunes) < 10 {
|
||||
length = len(topicRunes)
|
||||
}
|
||||
name := fmt.Sprintf("%s-%s-%s", input.Topic[:length], input.ContactType, nowStr)
|
||||
name := fmt.Sprintf("%s-%s-%s", string(topicRunes[:length]), input.ContactType, nowStr)
|
||||
var err error
|
||||
input.Name, err = db.GenerateName(ctx, nm, ownerId, name)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user