From f39750e39357fa9f4844365ab6db798c1eb14d03 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 15 Jul 2022 11:11:54 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E8=B5=84=E6=BA=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=87=8D=E5=91=BD=E5=90=8D=20https://github.com/siyua?= =?UTF-8?q?n-note/siyuan/issues/3454?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/assets.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 93236525d..2973e0320 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)