🎨 Limit the database title to 512 characters https://github.com/siyuan-note/siyuan/issues/15459

This commit is contained in:
Daniel 2025-08-08 15:12:00 +08:00
parent b40f8c898a
commit 683ba32918
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 5 additions and 5 deletions

View file

@ -2928,8 +2928,8 @@ func (tx *Transaction) setAttributeViewName(operation *Operation) (err error) {
attrView.Name = strings.TrimSpace(operation.Data.(string))
attrView.Name = strings.ReplaceAll(attrView.Name, "\n", " ")
if 256 < len(attrView.Name) {
attrView.Name = gulu.Str.SubStr(attrView.Name, 256)
if 512 < len(attrView.Name) {
attrView.Name = gulu.Str.SubStr(attrView.Name, 512)
}
err = av.SaveAttributeView(attrView)

View file

@ -95,10 +95,10 @@ func checkAttrView(attrView *av.AttributeView, view *av.View) {
}
}
// 截断超长的数据库标题 Limit the database title to 256 characters https://github.com/siyuan-note/siyuan/issues/15459
if 256 < utf8.RuneCountInString(attrView.Name) {
// 截断超长的数据库标题 Limit the database title to 512 characters https://github.com/siyuan-note/siyuan/issues/15459
if 512 < utf8.RuneCountInString(attrView.Name) {
attrView.Name = strings.ReplaceAll(attrView.Name, "\n", " ")
attrView.Name = gulu.Str.SubStr(attrView.Name, 256)
attrView.Name = gulu.Str.SubStr(attrView.Name, 512)
changed = true
}