This commit is contained in:
Liang Ding 2022-07-15 11:18:35 +08:00
parent 14c023477c
commit ba329cb252
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -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))