Skip to content

Commit

Permalink
🎨 Rename the .sya annotation file when renaming a PDF asset #9390
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 10, 2023
1 parent 964c822 commit 28e4e1e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/model/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 28e4e1e

Please sign in to comment.