From 8e060e23e345c8135b149e570444b515607c5205 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 18 May 2016 14:27:17 +0000 Subject: [PATCH] lib/connections: Correctly add port to portless tcp:// URLs (fixes #3115) GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3116 --- lib/connections/tcp_listen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connections/tcp_listen.go b/lib/connections/tcp_listen.go index 666c40ca..ba78a76a 100644 --- a/lib/connections/tcp_listen.go +++ b/lib/connections/tcp_listen.go @@ -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")