mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-28 19:26:09 +01:00
🎨 限制笔记本名和文档名最大长度为 512 https://github.com/siyuan-note/siyuan/issues/6299
This commit is contained in:
parent
6d2ff690b2
commit
569cd2814a
7 changed files with 15 additions and 8 deletions
|
|
@ -1270,7 +1270,7 @@ func RenameDoc(boxID, p, title string) (err error) {
|
|||
|
||||
title = gulu.Str.RemoveInvisible(title)
|
||||
if 512 < utf8.RuneCountInString(title) {
|
||||
// 限制文档名称最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
|
||||
// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
|
||||
return errors.New(Conf.Language(106))
|
||||
}
|
||||
|
||||
|
|
@ -1391,9 +1391,8 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) {
|
|||
|
||||
func createDoc(boxID, p, title, dom string) (err error) {
|
||||
title = gulu.Str.RemoveInvisible(title)
|
||||
|
||||
if 512 < utf8.RuneCountInString(title) {
|
||||
// 限制文档名称最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
|
||||
// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
|
||||
return errors.New(Conf.Language(106))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"runtime/debug"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
|
|
@ -34,6 +35,13 @@ import (
|
|||
)
|
||||
|
||||
func CreateBox(name string) (id string, err error) {
|
||||
name = gulu.Str.RemoveInvisible(name)
|
||||
if 512 < utf8.RuneCountInString(name) {
|
||||
// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
|
||||
err = errors.New(Conf.Language(106))
|
||||
return
|
||||
}
|
||||
|
||||
id = ast.NewNodeID()
|
||||
boxLocalPath := filepath.Join(util.DataDir, id)
|
||||
err = os.MkdirAll(boxLocalPath, 0755)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue