From 28c7f6df7f0439a5d44a9616f7055d88275d9e25 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 20 Dec 2023 11:08:19 +0800 Subject: [PATCH] :art: Keep original creation time when importing .sy.zip https://github.com/siyuan-note/siyuan/issues/9923 --- kernel/model/import.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/model/import.go b/kernel/model/import.go index 1ed0ce561..04116b306 100644 --- a/kernel/model/import.go +++ b/kernel/model/import.go @@ -147,7 +147,9 @@ func ImportSY(zipPath, boxID, toPath string) (err error) { return ast.WalkContinue } - newNodeID := ast.NewNodeID() + // 新 ID 保留时间部分,仅修改随机值,避免时间变化导致更新时间早于创建时间 + // Keep original creation time when importing .sy.zip https://github.com/siyuan-note/siyuan/issues/9923 + newNodeID := util.TimeFromID(n.ID) + "-" + gulu.Rand.String(7) blockIDs[n.ID] = newNodeID oldNodeID := n.ID n.ID = newNodeID