diff --git a/internal/config/config.go b/internal/config/config.go index 0fd9cf03a..375484dcd 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -578,7 +578,7 @@ func fillNilSlices(data interface{}) error { func uniqueStrings(ss []string) []string { var m = make(map[string]bool, len(ss)) for _, s := range ss { - m[s] = true + m[strings.Trim(s, " ")] = true } var us = make([]string, 0, len(m)) diff --git a/internal/config/config_test.go b/internal/config/config_test.go index b792b0eb4..51a500bb7 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -317,6 +317,29 @@ func TestIssue1262(t *testing.T) { } } +func TestIssue1750(t *testing.T) { + cfg, err := Load("testdata/issue-1750.xml", device4) + if err != nil { + t.Fatal(err) + } + + if cfg.Options().ListenAddress[0] != ":23000" { + t.Errorf("%q != %q", cfg.Options().ListenAddress[0], ":23000") + } + + if cfg.Options().ListenAddress[1] != ":23001" { + t.Errorf("%q != %q", cfg.Options().ListenAddress[1], ":23001") + } + + if cfg.Options().GlobalAnnServers[0] != "udp4://syncthing.nym.se:22026" { + t.Errorf("%q != %q", cfg.Options().GlobalAnnServers[0], "udp4://syncthing.nym.se:22026") + } + + if cfg.Options().GlobalAnnServers[1] != "udp4://syncthing.nym.se:22027" { + t.Errorf("%q != %q", cfg.Options().GlobalAnnServers[1], "udp4://syncthing.nym.se:22027") + } +} + func TestWindowsPaths(t *testing.T) { if runtime.GOOS != "windows" { t.Skip("Not useful on non-Windows") diff --git a/internal/config/testdata/issue-1750.xml b/internal/config/testdata/issue-1750.xml new file mode 100644 index 000000000..af193d5b5 --- /dev/null +++ b/internal/config/testdata/issue-1750.xml @@ -0,0 +1,8 @@ + + + :23000 + :23001 + udp4://syncthing.nym.se:22026 + udp4://syncthing.nym.se:22027 + +