diff --git a/kernel/api/av.go b/kernel/api/av.go index 7be4b50d1..383a09cca 100644 --- a/kernel/api/av.go +++ b/kernel/api/av.go @@ -27,6 +27,19 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) +func reloadAttributeView(c *gin.Context) { + ret := gulu.Ret.NewResult() + defer c.JSON(http.StatusOK, ret) + + arg, ok := util.JsonArg(c, ret) + if !ok { + return + } + + id := arg["id"].(string) + model.ReloadAttrView(id) +} + func duplicateAttributeViewBlock(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) diff --git a/kernel/api/router.go b/kernel/api/router.go index 8c43706ee..b48e5e0d7 100644 --- a/kernel/api/router.go +++ b/kernel/api/router.go @@ -452,6 +452,7 @@ func ServeAPI(ginServer *gin.Engine) { ginServer.Handle("POST", "/api/av/getAttributeViewKeysByAvID", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, getAttributeViewKeysByAvID) ginServer.Handle("POST", "/api/av/duplicateAttributeViewBlock", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, duplicateAttributeViewBlock) ginServer.Handle("POST", "/api/av/appendAttributeViewDetachedBlocksWithValues", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, appendAttributeViewDetachedBlocksWithValues) + ginServer.Handle("POST", "/api/av/reloadAttributeView", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, reloadAttributeView) ginServer.Handle("POST", "/api/ai/chatGPT", model.CheckAuth, model.CheckAdminRole, chatGPT) ginServer.Handle("POST", "/api/ai/chatGPTWithAction", model.CheckAuth, model.CheckAdminRole, chatGPTWithAction) diff --git a/kernel/model/file.go b/kernel/model/file.go index c587b715c..60b568695 100644 --- a/kernel/model/file.go +++ b/kernel/model/file.go @@ -1080,6 +1080,7 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) { FlushTxQueue() + hPath = util.TrimSpaceInPath(hPath) existRoot := treenode.GetBlockTreeRootByHPath(box.ID, hPath) if nil != existRoot { existed = true diff --git a/kernel/model/path.go b/kernel/model/path.go index 7979ce4b4..d0ea6a2de 100644 --- a/kernel/model/path.go +++ b/kernel/model/path.go @@ -40,6 +40,7 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string) (retID string retID = id hPath = strings.TrimSuffix(hPath, ".sy") + hPath = util.TrimSpaceInPath(hPath) if "" != parentID { // The save path is incorrect when creating a sub-doc by ref in a doc with the same name https://github.com/siyuan-note/siyuan/issues/8138 // 在指定了父文档 ID 的情况下优先查找父文档