Skip to content

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

:art: 文件夹不编入路径映射

Liang Ding42ff4a8fe45b
diff --git a/kernel/model/osssync.go b/kernel/model/osssync.go
index b5e09d6a75..6352be4aa7 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 8c2057cf8f..82b7e06eb4 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
}