An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Rollback document exception after moving document https://github.com/siyuan-note/siyuan/issues/14107
Daniel1385870e39bd
diff --git a/kernel/model/history.go b/kernel/model/history.goindex 41d474c707..cd98a09130 100644--- a/kernel/model/history.go+++ b/kernel/model/history.go@@ -245,7 +245,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {}}- destPath, parentHPath, err = getRollbackDockPath(boxID, historyPath)+ destPath, parentHPath, err = getRollbackDockPath(boxID, workingDoc)if err != nil {return}@@ -338,10 +338,15 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {return nil}-func getRollbackDockPath(boxID, historyPath string) (destPath, parentHPath string, err error) {- baseName := filepath.Base(historyPath)- parentID := path.Base(filepath.Dir(historyPath))- parentWorkingDoc := treenode.GetBlockTree(parentID)+func getRollbackDockPath(boxID string, workingDoc *treenode.BlockTree) (destPath, parentHPath string, err error) {+ var parentID, baseName string+ var parentWorkingDoc *treenode.BlockTree+ if nil != workingDoc {+ baseName = path.Base(workingDoc.Path)+ parentID = path.Base(path.Dir(workingDoc.Path))+ parentWorkingDoc = treenode.GetBlockTree(parentID)+ }+if nil != parentWorkingDoc {// 父路径如果是文档,则恢复到父路径下parentDir := strings.TrimSuffix(parentWorkingDoc.Path, ".sy")