Fix ipv6 parsing for builtin ssh server (#17561)

This commit is contained in:
Wim 2021-11-06 07:23:32 +01:00 committed by GitHub
parent 5e0cf4b82e
commit bd613c704c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -13,6 +13,7 @@ import (
"os"
"path"
"path/filepath"
"strconv"
"strings"
"testing"
"time"
@ -55,7 +56,7 @@ func createSSHUrl(gitPath string, u *url.URL) *url.URL {
u2 := *u
u2.Scheme = "ssh"
u2.User = url.User("git")
u2.Host = fmt.Sprintf("%s:%d", setting.SSH.ListenHost, setting.SSH.ListenPort)
u2.Host = net.JoinHostPort(setting.SSH.ListenHost, strconv.Itoa(setting.SSH.ListenPort))
u2.Path = gitPath
return &u2
}