mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 When New document save location is configured as ../, it will be completed as ../Untitled Fix https://github.com/siyuan-note/siyuan/issues/8238
This commit is contained in:
parent
0bfc2b5c64
commit
182f767469
4 changed files with 23 additions and 0 deletions
|
|
@ -528,6 +528,14 @@ func getDocCreateSavePath(c *gin.Context) {
|
||||||
if "" == docCreateSavePathTpl {
|
if "" == docCreateSavePathTpl {
|
||||||
docCreateSavePathTpl = model.Conf.FileTree.DocCreateSavePath
|
docCreateSavePathTpl = model.Conf.FileTree.DocCreateSavePath
|
||||||
}
|
}
|
||||||
|
docCreateSavePathTpl = strings.TrimSpace(docCreateSavePathTpl)
|
||||||
|
if "../" == docCreateSavePathTpl {
|
||||||
|
docCreateSavePathTpl = "../Untitled"
|
||||||
|
}
|
||||||
|
for strings.HasSuffix(docCreateSavePathTpl, "/") {
|
||||||
|
docCreateSavePathTpl = strings.TrimSuffix(docCreateSavePathTpl, "/")
|
||||||
|
docCreateSavePathTpl = strings.TrimSpace(docCreateSavePathTpl)
|
||||||
|
}
|
||||||
|
|
||||||
p, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
p, err := model.RenderGoTemplate(docCreateSavePathTpl)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,15 @@ func setNotebookConf(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boxConf.DocCreateSavePath = strings.TrimSpace(boxConf.DocCreateSavePath)
|
||||||
|
if "../" == boxConf.DocCreateSavePath {
|
||||||
|
boxConf.DocCreateSavePath = "../Untitled"
|
||||||
|
}
|
||||||
|
for strings.HasSuffix(boxConf.DocCreateSavePath, "/") {
|
||||||
|
boxConf.DocCreateSavePath = strings.TrimSuffix(boxConf.DocCreateSavePath, "/")
|
||||||
|
boxConf.DocCreateSavePath = strings.TrimSpace(boxConf.DocCreateSavePath)
|
||||||
|
}
|
||||||
|
|
||||||
box.SaveConf(boxConf)
|
box.SaveConf(boxConf)
|
||||||
ret.Data = boxConf
|
ret.Data = boxConf
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,9 @@ func setFiletree(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fileTree.DocCreateSavePath = strings.TrimSpace(fileTree.DocCreateSavePath)
|
fileTree.DocCreateSavePath = strings.TrimSpace(fileTree.DocCreateSavePath)
|
||||||
|
if "../" == fileTree.DocCreateSavePath {
|
||||||
|
fileTree.DocCreateSavePath = "../Untitled"
|
||||||
|
}
|
||||||
for strings.HasSuffix(fileTree.DocCreateSavePath, "/") {
|
for strings.HasSuffix(fileTree.DocCreateSavePath, "/") {
|
||||||
fileTree.DocCreateSavePath = strings.TrimSuffix(fileTree.DocCreateSavePath, "/")
|
fileTree.DocCreateSavePath = strings.TrimSuffix(fileTree.DocCreateSavePath, "/")
|
||||||
fileTree.DocCreateSavePath = strings.TrimSpace(fileTree.DocCreateSavePath)
|
fileTree.DocCreateSavePath = strings.TrimSpace(fileTree.DocCreateSavePath)
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,9 @@ func InitConf() {
|
||||||
Conf.FileTree.MaxOpenTabCount = 32
|
Conf.FileTree.MaxOpenTabCount = 32
|
||||||
}
|
}
|
||||||
Conf.FileTree.DocCreateSavePath = strings.TrimSpace(Conf.FileTree.DocCreateSavePath)
|
Conf.FileTree.DocCreateSavePath = strings.TrimSpace(Conf.FileTree.DocCreateSavePath)
|
||||||
|
if "../" == Conf.FileTree.DocCreateSavePath {
|
||||||
|
Conf.FileTree.DocCreateSavePath = "../Untitled"
|
||||||
|
}
|
||||||
for strings.HasSuffix(Conf.FileTree.DocCreateSavePath, "/") {
|
for strings.HasSuffix(Conf.FileTree.DocCreateSavePath, "/") {
|
||||||
Conf.FileTree.DocCreateSavePath = strings.TrimSuffix(Conf.FileTree.DocCreateSavePath, "/")
|
Conf.FileTree.DocCreateSavePath = strings.TrimSuffix(Conf.FileTree.DocCreateSavePath, "/")
|
||||||
Conf.FileTree.DocCreateSavePath = strings.TrimSpace(Conf.FileTree.DocCreateSavePath)
|
Conf.FileTree.DocCreateSavePath = strings.TrimSpace(Conf.FileTree.DocCreateSavePath)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue