From 9ba54bf4952588209bf40e8a0502ecdd760d9975 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 6 Jun 2022 00:20:04 +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 | 4 ++++ kernel/model/sync.go | 18 +----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/kernel/model/osssync.go b/kernel/model/osssync.go index 3e5d7da71..b5e09d6a7 100644 --- a/kernel/model/osssync.go +++ b/kernel/model/osssync.go @@ -291,6 +291,10 @@ func ossDownload(isBackup bool, localDirPath, cloudDirPath string, bootOrExit bo // 同步下载可能会报错,为了确保本地数据版本号不变所以不能更新配置文件,配置文件最后单独下载 continue } + if "/"+pathJSON == fetch { + // 已经在前面验证解密的步骤中下载过了,目前位于 temp/sync/pathJSON + continue + } waitGroup.Add(1) p.Invoke(fetch) diff --git a/kernel/model/sync.go b/kernel/model/sync.go index 379f8c3c4..8c2057cf8 100644 --- a/kernel/model/sync.go +++ b/kernel/model/sync.go @@ -329,22 +329,6 @@ func SyncData(boot, exit, byHand bool) { return } - // 解密验证成功后将其移动到 sync/ 文件夹下 - if err = os.Rename(tmpPathJSON, filepath.Join(localSyncDirPath, pathJSON)); nil != err { - util.PushClearProgress() - msg := fmt.Sprintf(Conf.Language(80), formatErrorMsg(err)) - Conf.Sync.Stat = msg - util.PushErrMsg(msg, 7000) - if boot { - BootSyncSucc = 1 - } - if exit { - ExitSyncSucc = 1 - } - syncDownloadErrCount++ - return - } - fetchedFilesCount, transferSize, downloadedFiles, err := ossDownload(false, localSyncDirPath, "sync/"+Conf.Sync.CloudName, boot || exit, removeList, upsertList) if nil != err { util.PushClearProgress() @@ -569,7 +553,7 @@ func syncDir2WorkspaceData(boot bool) (upsertFiles, removeFiles []string, err er } modified := modifiedSyncList(unchanged) - metaPath := filepath.Join(Conf.Sync.GetSaveDir(), pathJSON) + metaPath := filepath.Join(util.TempDir, "sync", pathJSON) // 使用前面解密验证时下载的临时文件 indexPath := filepath.Join(Conf.Sync.GetSaveDir(), "index.json") decryptedDataDir, upsertFiles, err := recoverSyncData(metaPath, indexPath, modified) if nil != err {