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 }