1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-13 14:07:20 +00:00

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
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
}