An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Clarify missing S3 configuration input https://github.com/siyuan-note/siyuan/issues/20427
Danielfec9cf9f5f71
diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex 7997f8eef6..7cc82dca05 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -679,11 +679,11 @@ func SetSyncProviderS3(s3 *conf.S3) (err error) {func validateSyncS3(s3 *conf.S3) error {if s3 == nil {- return errors.New(Conf.Language(249))+ return errors.New(Conf.Language(142))}for _, value := range []string{s3.Endpoint, s3.AccessKey, s3.SecretKey, s3.Bucket, s3.Region} {if strings.TrimSpace(value) == "" {- return errors.New(Conf.Language(249))+ return errors.New(Conf.Language(142))}}rawEndpoint := strings.TrimSpace(s3.Endpoint)diff --git a/kernel/model/sync_s3_validation_test.go b/kernel/model/sync_s3_validation_test.goindex 1dc0312b56..0b676add3e 100644--- a/kernel/model/sync_s3_validation_test.go+++ b/kernel/model/sync_s3_validation_test.go@@ -12,10 +12,14 @@ import (func TestS3ConfigurationValidation(t *testing.T) {prepareSyncDirectoryTest(t)+ originalLangs := util.Langs+ util.Langs = map[string]map[int]string{"en": {142: "Input cannot be empty", 249: "Configuration or permission error"}}+ t.Cleanup(func() { util.Langs = originalLangs })valid := conf.S3{Endpoint: "https://storage.example.com", AccessKey: "key", SecretKey: "secret", Bucket: "notes", Region: "auto"}for _, field := range []string{"endpoint", "accessKey", "secretKey", "bucket", "region", "scheme", "host"} {t.Run(field, func(t *testing.T) {candidate := valid+ message := Conf.Language(142)switch field {case "endpoint":candidate.Endpoint = " "@@ -29,8 +33,10 @@ func TestS3ConfigurationValidation(t *testing.T) {candidate.Region = " "case "scheme":candidate.Endpoint = "ftp://storage.example.com"+ message = Conf.Language(249)case "host":candidate.Endpoint = "https://"+ message = Conf.Language(249)}Conf.Sync.S3 = &validConf.Save()@@ -39,7 +45,7 @@ func TestS3ConfigurationValidation(t *testing.T) {if err != nil {t.Fatal(err)}- if err = SetSyncProviderS3(&candidate); err == nil || err.Error() != Conf.Language(249) {+ if err = SetSyncProviderS3(&candidate); err == nil || err.Error() != message {t.Fatalf("expected localized configuration error: %v", err)}after, err := os.ReadFile(path)@@ -47,7 +53,7 @@ func TestS3ConfigurationValidation(t *testing.T) {t.Fatal("invalid configuration changed the saved settings")}Conf.Sync.S3 = &candidate- if _, err = GetCloudRepoTagSnapshots(); err == nil || err.Error() != Conf.Language(249) {+ if _, err = GetCloudRepoTagSnapshots(); err == nil || err.Error() != message {t.Fatalf("cloud tags did not reject invalid settings: %v", err)}if _, _, _, err = GetCloudRepoSnapshots(1); err == nil {@@ -64,8 +70,8 @@ func TestS3ConfigurationValidation(t *testing.T) {t.Fatalf("valid endpoint %q rejected: %v", endpoint, err)}}- if err := validateSyncS3(nil); err == nil {- t.Fatal("nil configuration accepted")+ if err := validateSyncS3(nil); err == nil || err.Error() != Conf.Language(142) {+ t.Fatalf("expected missing-input error for nil configuration: %v", err)}Conf.Sync.S3 = &conf.S3{}if _, err := newRepository(); err != nil {