From f3bff8fdc0f3750e3be2c8425b0c096fb49df937 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 9 Jun 2022 11:34:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:bug:=20=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=95=B0=E6=8D=AE=E6=97=B6=E6=8A=A5=E9=94=99?= =?UTF-8?q?=20`index.json`=20=E6=89=BE=E4=B8=8D=E5=88=B0=20Fix=20https://g?= =?UTF-8?q?ithub.com/siyuan-note/siyuan/issues/5133?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/sync.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/model/sync.go b/kernel/model/sync.go index 475b6c930..5ea4c026e 100644 --- a/kernel/model/sync.go +++ b/kernel/model/sync.go @@ -557,7 +557,7 @@ func syncDir2WorkspaceData(boot bool) (upsertFiles, removeFiles []string, err er modified := modifiedSyncList(unchanged) metaPath := filepath.Join(util.TempDir, "sync", pathJSON) // 使用前面解密验证时下载的临时文件 - indexPath := filepath.Join(Conf.Sync.GetSaveDir(), "index.json") + indexPath := filepath.Join(util.TempDir, "sync", "index.json") decryptedDataDir, upsertFiles, err := recoverSyncData(metaPath, indexPath, modified) if nil != err { util.LogErrorf("decrypt data dir failed: %s", err) From 339783598e52eec9ca66d5558bacac072c00b16d Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 9 Jun 2022 15:40:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:art:=20=E6=9B=B4=E6=96=B0=E8=8A=82?= =?UTF-8?q?=E7=82=B9=20`updated`=20=E6=97=B6=E4=B8=8D=E5=86=8D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=AD=90=E8=8A=82=E7=82=B9=20`updated`=20Fix=20https:?= =?UTF-8?q?//github.com/siyuan-note/siyuan/issues/5138=20=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8=E9=A1=B9=E5=AE=8C=E6=88=90=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=94=B9=E5=8F=98=E4=BB=A5=E5=90=8E=20`updated`=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0=20Fix=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/5136?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/transaction.go | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index 881013952..5c32db7e4 100644 --- a/kernel/model/transaction.go +++ b/kernel/model/transaction.go @@ -1057,27 +1057,19 @@ func refreshUpdated(n *ast.Node) { } } -func createdUpdated(n *ast.Node) { - ast.Walk(n, func(n *ast.Node, entering bool) ast.WalkStatus { - if !entering || "" == n.ID { - return ast.WalkContinue - } - - created := util.TimeFromID(n.ID) - updated := n.IALAttr("updated") - if "" == updated { - updated = created - } - if updated < created { - updated = created // 复制粘贴块后创建时间小于更新时间 https://github.com/siyuan-note/siyuan/issues/3624 - } - n.SetIALAttr("updated", updated) - parents := treenode.ParentNodes(n) - for _, parent := range parents { // 更新所有父节点的更新时间字段 - parent.SetIALAttr("updated", updated) - } - return ast.WalkContinue - }) +func createdUpdated(node *ast.Node) { + created := util.TimeFromID(node.ID) + updated := node.IALAttr("updated") + if "" == updated { + updated = created + } + if updated < created { + updated = created // 复制粘贴块后创建时间小于更新时间 https://github.com/siyuan-note/siyuan/issues/3624 + } + parents := treenode.ParentNodes(node) + for _, parent := range parents { // 更新所有父节点的更新时间字段 + parent.SetIALAttr("updated", updated) + } } type Operation struct {