mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
🎨 Limit the database title to 512 characters https://github.com/siyuan-note/siyuan/issues/15459
This commit is contained in:
parent
b40f8c898a
commit
683ba32918
2 changed files with 5 additions and 5 deletions
|
|
@ -2928,8 +2928,8 @@ func (tx *Transaction) setAttributeViewName(operation *Operation) (err error) {
|
||||||
|
|
||||||
attrView.Name = strings.TrimSpace(operation.Data.(string))
|
attrView.Name = strings.TrimSpace(operation.Data.(string))
|
||||||
attrView.Name = strings.ReplaceAll(attrView.Name, "\n", " ")
|
attrView.Name = strings.ReplaceAll(attrView.Name, "\n", " ")
|
||||||
if 256 < len(attrView.Name) {
|
if 512 < len(attrView.Name) {
|
||||||
attrView.Name = gulu.Str.SubStr(attrView.Name, 256)
|
attrView.Name = gulu.Str.SubStr(attrView.Name, 512)
|
||||||
}
|
}
|
||||||
err = av.SaveAttributeView(attrView)
|
err = av.SaveAttributeView(attrView)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
// 截断超长的数据库标题 Limit the database title to 512 characters https://github.com/siyuan-note/siyuan/issues/15459
|
||||||
if 256 < utf8.RuneCountInString(attrView.Name) {
|
if 512 < utf8.RuneCountInString(attrView.Name) {
|
||||||
attrView.Name = strings.ReplaceAll(attrView.Name, "\n", " ")
|
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
|
changed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue