From ba329cb252fd7eee4f51361078692c47a73810fa Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 15 Jul 2022 11:18:35 +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, 5 insertions(+), 5 deletions(-) diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 04e0ba25a..6cc0978ab 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))