fix: non-standard ssh port URL's repo can't be recognized (#555)

Resolve #452

Reviewed-on: https://gitea.com/gitea/tea/pulls/555
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Grady Wong <wgqimut@gmail.com>
Co-committed-by: Grady Wong <wgqimut@gmail.com>
This commit is contained in:
Grady Wong 2023-06-06 13:14:21 +00:00 committed by 6543
parent 07039b82e3
commit b2d845b8c7
2 changed files with 3 additions and 3 deletions

View File

@ -228,5 +228,5 @@ func (l *Login) GetSSHHost() string {
return ""
}
return u.Hostname()
return u.Host
}

View File

@ -90,8 +90,8 @@ func CreateLogin(name, token, user, passwd, sshKey, giteaURL, sshCertPrincipal,
}
// we do not have a method to get SSH config from api,
// so we just use the hostname
login.SSHHost = serverURL.Hostname()
// so we just use the host
login.SSHHost = serverURL.Host
if len(sshKey) == 0 {
login.SSHKey, err = findSSHKey(client)