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 Dingf39750e39357
diff --git a/kernel/model/assets.go b/kernel/model/assets.go
index 93236525d4..2973e0320a 100644
--- a/kernel/model/assets.go
+++ b/kernel/model/assets.go
@@ -453,8 +453,16 @@ func RenameAsset(oldPath, newName string) {
return
}
- newPath := util.AssetName(newName)
+ newName = strings.TrimSpace(newName)
+ newName = gulu.Str.RemoveInvisible(newName)
+ if path.Base(oldPath) == newName {
+ return
+ }
+ if "" == newName {
+ return
+ }
+ newPath := util.AssetName(newName)
luteEngine := NewLute()
for _, notebook := range notebooks {
pages := pagedPaths(filepath.Join(util.DataDir, notebook.ID), 32)