diff options
author | Paulo Gomes <pjbgf@linux.com> | 2023-08-05 09:57:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 09:57:13 +0100 |
commit | 4ec6b3f4fa9cdfe8f10d0953ac7d398d01a90f17 (patch) | |
tree | 3c4598f02b91cbb6374211e088b6e9350c6ac5c1 /plumbing/transport/common.go | |
parent | 36477e82f22623018ff170af8afc10c2c9bd50c5 (diff) | |
parent | a105da84747df637fa7913c3ab880be73019e502 (diff) | |
download | go-git-4ec6b3f4fa9cdfe8f10d0953ac7d398d01a90f17.tar.gz |
Merge pull request #820 from ninedraft/ninedraft/issue740
plumbing: transport, handle IPv6 while parsing endpoint. Fixes #740
Diffstat (limited to 'plumbing/transport/common.go')
-rw-r--r-- | plumbing/transport/common.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plumbing/transport/common.go b/plumbing/transport/common.go index 89bd3d5..c6a054a 100644 --- a/plumbing/transport/common.go +++ b/plumbing/transport/common.go @@ -227,11 +227,17 @@ func parseURL(endpoint string) (*Endpoint, error) { pass, _ = u.User.Password() } + host := u.Hostname() + if strings.Contains(host, ":") { + // IPv6 address + host = "[" + host + "]" + } + return &Endpoint{ Protocol: u.Scheme, User: user, Password: pass, - Host: u.Hostname(), + Host: host, Port: getPort(u), Path: getPath(u), }, nil |