🎨 Rename the .sya annotation file when renaming a PDF asset https://github.com/siyuan-note/siyuan/issues/9390

This commit is contained in:
Daniel 2023-10-10 22:31:46 +08:00
parent 964c822c2b
commit 28e4e1ef2f
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -512,6 +512,15 @@ func RenameAsset(oldPath, newName string) (err error) {
logging.LogErrorf("copy asset [%s] failed: %s", oldPath, err)
return
}
if gulu.File.IsExist(filepath.Join(util.DataDir, oldPath+".sya")) {
// Rename the .sya annotation file when renaming a PDF asset https://github.com/siyuan-note/siyuan/issues/9390
if err = filelock.Copy(filepath.Join(util.DataDir, oldPath+".sya"), filepath.Join(util.DataDir, newPath+".sya")); nil != err {
logging.LogErrorf("copy PDF annotation [%s] failed: %s", oldPath+".sya", err)
return
}
}
oldName := path.Base(oldPath)
notebooks, err := ListNotebooks()