📝 优化文档标题不支持 / 提示信息位置 https://github.com/siyuan-note/siyuan/issues/6516

This commit is contained in:
Liang Ding 2022-11-15 10:59:05 +08:00
parent f3b3d4065d
commit eb7b544fd1
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
6 changed files with 7 additions and 5 deletions

View file

@ -1293,6 +1293,7 @@ func RenameDoc(boxID, p, title string) (err error) {
if "" == title {
title = "Untitled"
}
title = strings.ReplaceAll(title, "/", "")
oldHPath := tree.HPath
tree.HPath = path.Join(path.Dir(tree.HPath), title)
@ -1398,6 +1399,7 @@ func createDoc(boxID, p, title, dom string) (err error) {
// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299
return errors.New(Conf.Language(106))
}
title = strings.ReplaceAll(title, "/", "")
baseName := strings.TrimSpace(path.Base(p))
if "" == strings.TrimSuffix(baseName, ".sy") {