An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve asset renaming https://github.com/siyuan-note/siyuan/issues/11889
Daniel427293f3e662
diff --git a/kernel/api/asset.go b/kernel/api/asset.goindex d4c0790190..76647e3661 100644--- a/kernel/api/asset.go+++ b/kernel/api/asset.go@@ -159,13 +159,16 @@ func renameAsset(c *gin.Context) {oldPath := arg["oldPath"].(string)newName := arg["newName"].(string)- err := model.RenameAsset(oldPath, newName)+ newPath, err := model.RenameAsset(oldPath, newName)if nil != err {ret.Code = -1ret.Msg = err.Error()ret.Data = map[string]interface{}{"closeTimeout": 5000}return}+ ret.Data = map[string]interface{}{+ "newPath": newPath,+ }}func getDocImageAssets(c *gin.Context) {diff --git a/kernel/model/assets.go b/kernel/model/assets.goindex 19a8cab042..2300523c13 100644--- a/kernel/model/assets.go+++ b/kernel/model/assets.go@@ -762,7 +762,7 @@ func RemoveUnusedAsset(p string) (ret string) {return}-func RenameAsset(oldPath, newName string) (err error) {+func RenameAsset(oldPath, newName string) (newPath string, err error) {util.PushEndlessProgress(Conf.Language(110))defer util.PushClearProgress()@@ -781,7 +781,7 @@ func RenameAsset(oldPath, newName string) (err error) {}newName = util.AssetName(newName + filepath.Ext(oldPath))- newPath := "assets/" + newName+ newPath = "assets/" + newNameif err = filelock.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {logging.LogErrorf("copy asset [%s] failed: %s", oldPath, err)return@@ -842,7 +842,6 @@ func RenameAsset(oldPath, newName string) (err error) {}IncSync()- util.ReloadUI()return}