From 1385870e39bd761fb5b5201d0740ac2bdb790b69 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 16 Feb 2025 12:25:21 +0800 Subject: [PATCH 1/2] :bug: Rollback document exception after moving document https://github.com/siyuan-note/siyuan/issues/14107 --- kernel/model/history.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kernel/model/history.go b/kernel/model/history.go index 41d474c70..cd98a0913 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") From 00c2d79fe007f57504835c5a73bef4788c420321 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 16 Feb 2025 14:25:31 +0800 Subject: [PATCH 2/2] :art: Convert ref to text only when sharing to the community https://github.com/siyuan-note/siyuan/issues/14100 --- kernel/model/export.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/export.go b/kernel/model/export.go index c4ec254be..6f82f4771 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -269,7 +269,7 @@ func Export2Liandi(id string) (err error) { title := path.Base(tree.HPath) tags := tree.Root.IALAttr("tags") content := exportMarkdownContent0(tree, util.GetCloudForumAssetsServer()+time.Now().Format("2006/01")+"/siyuan/"+Conf.GetUser().UserId+"/", true, - ".md", 4, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, + ".md", 3, 1, 1, "#", "#", "", "", false, nil, true, &map[string]*parse.Tree{})