An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: 资源文件重命名 https://github.com/siyuan-note/siyuan/issues/3454
Liang Ding3727bd725413
diff --git a/kernel/model/assets.go b/kernel/model/assets.goindex ee0b6dd9a2..32d427e327 100644--- a/kernel/model/assets.go+++ b/kernel/model/assets.go@@ -34,7 +34,6 @@ import ("github.com/88250/gulu""github.com/88250/lute/ast""github.com/88250/lute/parse"- "github.com/88250/protyle""github.com/gabriel-vasile/mimetype""github.com/siyuan-note/filelock""github.com/siyuan-note/httpclient"@@ -462,13 +461,14 @@ func RenameAsset(oldPath, newName string) (err error) {return}- newPath := "assets/" + util.AssetName(newName) + filepath.Ext(oldPath)+ newName = util.AssetName(newName) + filepath.Ext(oldPath)+ newPath := "assets/" + newNameif err = gulu.File.Copy(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {util.LogErrorf("copy asset [%s] failed: %s", oldPath, err)return}+ oldName := path.Base(oldPath)- luteEngine := NewLute()notebooks, err := ListNotebooks()if nil != err {return@@ -484,18 +484,19 @@ func RenameAsset(oldPath, newName string) (err error) {return}- if !bytes.Contains(data, []byte(oldPath)) {+ if !bytes.Contains(data, []byte(oldName)) {continue}- data = bytes.Replace(data, []byte(oldPath), []byte(newPath), -1)+ data = bytes.Replace(data, []byte(oldName), []byte(newName), -1)if writeErr := filelock.NoLockFileWrite(treeAbsPath, data); nil != writeErr {util.LogErrorf("write data [path=%s] failed: %s", treeAbsPath, writeErr)err = writeErrreturn}- tree, parseErr := protyle.ParseJSONWithoutFix(luteEngine, data)+ p := filepath.ToSlash(strings.TrimPrefix(treeAbsPath, filepath.Join(util.DataDir, notebook.ID)))+ tree, parseErr := LoadTree(notebook.ID, p)if nil != parseErr {util.LogErrorf("parse json to tree [%s] failed: %s", treeAbsPath, parseErr)err = parseErr