lib/connections: Correctly add port to portless tcp:// URLs (fixes #3115)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3116
This commit is contained in:
Jakob Borg 2016-05-18 14:27:17 +00:00
parent 6e07742fe9
commit 8e060e23e3
1 changed files with 1 additions and 1 deletions

View File

@ -185,7 +185,7 @@ func fixupPort(uri *url.URL) *url.URL {
host, port, err := net.SplitHostPort(uri.Host)
if err != nil && strings.HasPrefix(err.Error(), "missing port") {
// addr is on the form "1.2.3.4"
copyURI.Host = net.JoinHostPort(host, "22000")
copyURI.Host = net.JoinHostPort(uri.Host, "22000")
} else if err == nil && port == "" {
// addr is on the form "1.2.3.4:"
copyURI.Host = net.JoinHostPort(host, "22000")