Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 同步下载支持断点续传 Fix https://github.com/siyuan-note/siyuan/issues/5056

Liang Dingfa45fafca415
diff --git a/kernel/model/sync.go b/kernel/model/sync.go
index 350e768323..708a34134b 100644
--- a/kernel/model/sync.go
+++ b/kernel/model/sync.go
@@ -300,7 +300,9 @@ func SyncData(boot, exit, byHand bool) {
syncDownloadErrCount++
return
}
- data, err := os.ReadFile(filepath.Join(util.TempDir, "/sync/"+pathJSON))
+
+ tmpPathJSON := filepath.Join(util.TempDir, "/sync/"+pathJSON)
+ data, err := os.ReadFile(tmpPathJSON)
if nil != err {
return
}
@@ -320,6 +322,20 @@ func SyncData(boot, exit, byHand bool) {
syncDownloadErrCount++
return
}
+ if err = os.Rename(tmpPathJSON, filepath.Join(localSyncDirPath, pathJSON)); nil != err {
+ util.PushClearMsg()
+ 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(localSyncDirPath, "sync/"+Conf.Sync.CloudName, boot || exit)
if nil != err {