🎨 Treat the renaming of tags and assets as a data history Replace operation https://github.com/siyuan-note/siyuan/issues/17407

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2026-04-18 12:27:01 +08:00
parent 935458d039
commit 1654612867
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -935,6 +935,7 @@ func RenameAsset(oldPath, newName string) (newPath string, err error) {
return
}
historyDir, err := getHistoryDir(HistoryOpReplace, time.Now())
luteEngine := util.NewLute()
for _, notebook := range notebooks {
pages := pagedPaths(filepath.Join(util.DataDir, notebook.ID), 32)
@ -967,6 +968,7 @@ func RenameAsset(oldPath, newName string) (newPath string, err error) {
continue
}
generateTreeHistory(historyDir, tree)
treenode.UpsertBlockTree(tree)
sql.UpsertTreeQueue(tree)
@ -974,6 +976,7 @@ func RenameAsset(oldPath, newName string) (newPath string, err error) {
}
}
}
indexHistoryDir(filepath.Base(historyDir), util.NewLute())
storageAvDir := filepath.Join(util.DataDir, "storage", "av")
if gulu.File.IsDir(storageAvDir) {