From 42ff4a8fe45bb0db15575878530d4d4f86781c33 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 6 Jun 2022 00:35:12 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=8D?= =?UTF-8?q?=E7=BC=96=E5=85=A5=E8=B7=AF=E5=BE=84=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/osssync.go | 12 ++++++++---- kernel/model/sync.go | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/model/osssync.go b/kernel/model/osssync.go index b5e09d6a7..6352be4aa 100644 --- a/kernel/model/osssync.go +++ b/kernel/model/osssync.go @@ -511,11 +511,11 @@ func ossUpload(isBackup bool, localDirPath, cloudDirPath, cloudDevice string, bo } }) index := filepath.Join(localDirPath, "index.json") + meta := filepath.Join(localDirPath, pathJSON) for _, localUpsert := range localUpserts { - if index == localUpsert { + if index == localUpsert || meta == localUpsert { // 同步过程中断导致的一致性问题 https://github.com/siyuan-note/siyuan/issues/4912 - // index 最后单独上传 - index = localUpsert + // index 和路径映射文件最后单独上传 continue } @@ -529,11 +529,15 @@ func ossUpload(isBackup bool, localDirPath, cloudDirPath, cloudDevice string, bo return } - // 单独上传 index + // 单独上传 index 和路径映射 if uploadErr = ossUpload0(localDirPath, cloudDirPath, index, &wroteFiles, &transferSize); nil != uploadErr { err = uploadErr return } + if uploadErr = ossUpload0(localDirPath, cloudDirPath, meta, &wroteFiles, &transferSize); nil != uploadErr { + err = uploadErr + return + } if needPushProgress { util.PushMsg(Conf.Language(105), 3000) diff --git a/kernel/model/sync.go b/kernel/model/sync.go index 8c2057cf8..82b7e06eb 100644 --- a/kernel/model/sync.go +++ b/kernel/model/sync.go @@ -1006,7 +1006,7 @@ func calcUnchangedDataList(passwd string) (unchangedDataList map[string]bool, re unchangedDataList = map[string]bool{} removeList = map[string]bool{} filepath.Walk(syncDir, func(path string, info fs.FileInfo, _ error) error { - if syncDir == path || pathJSON == info.Name() { + if syncDir == path || pathJSON == info.Name() || "index.json" == info.Name() || info.IsDir() { return nil }