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 {