mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 03:49:11 +08:00
🐛 Deleted documents cannot be rolled back https://github.com/siyuan-note/siyuan/issues/14239
This commit is contained in:
parent
51fb0ebb22
commit
a8416f39c2
@ -245,7 +245,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destPath, parentHPath, err = getRollbackDockPath(boxID, workingDoc)
|
destPath, parentHPath, err = getRollbackDockPath(boxID, historyPath, workingDoc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -338,13 +338,16 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRollbackDockPath(boxID string, workingDoc *treenode.BlockTree) (destPath, parentHPath string, err error) {
|
func getRollbackDockPath(boxID, historyPath string, workingDoc *treenode.BlockTree) (destPath, parentHPath string, err error) {
|
||||||
var parentID, baseName string
|
var parentID string
|
||||||
|
baseName := filepath.Base(historyPath)
|
||||||
var parentWorkingDoc *treenode.BlockTree
|
var parentWorkingDoc *treenode.BlockTree
|
||||||
if nil != workingDoc {
|
if nil != workingDoc {
|
||||||
baseName = path.Base(workingDoc.Path)
|
|
||||||
parentID = path.Base(path.Dir(workingDoc.Path))
|
parentID = path.Base(path.Dir(workingDoc.Path))
|
||||||
parentWorkingDoc = treenode.GetBlockTree(parentID)
|
parentWorkingDoc = treenode.GetBlockTree(parentID)
|
||||||
|
} else {
|
||||||
|
parentID = filepath.Base(filepath.Dir(historyPath))
|
||||||
|
parentWorkingDoc = treenode.GetBlockTree(parentID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil != parentWorkingDoc {
|
if nil != parentWorkingDoc {
|
||||||
|
Loading…
Reference in New Issue
Block a user