Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: 资源文件重命名 https://github.com/siyuan-note/siyuan/issues/3454

Liang Dingba329cb252fd
diff --git a/kernel/model/assets.go b/kernel/model/assets.go
index 04e0ba25a0..6cc0978abb 100644
--- a/kernel/model/assets.go
+++ b/kernel/model/assets.go
@@ -468,6 +468,11 @@ func RenameAsset(oldPath, newName string) (err error) {
}
newPath := util.AssetName(newName)
+ if 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
+ }
+
luteEngine := NewLute()
for _, notebook := range notebooks {
pages := pagedPaths(filepath.Join(util.DataDir, notebook.ID), 32)
@@ -506,11 +511,6 @@ func RenameAsset(oldPath, newName string) (err error) {
}
}
- if err = os.Rename(filepath.Join(util.DataDir, oldPath), filepath.Join(util.DataDir, newPath)); nil != err {
- util.LogErrorf("rename asset [%s] failed: %s", oldPath, err)
- return
- }
-
IncSync()
util.PushEndlessProgress(Conf.Language(113))