From b2d845b8c7e6722dda4183f0b6142b1efcec95dd Mon Sep 17 00:00:00 2001 From: Grady Wong Date: Tue, 6 Jun 2023 13:14:21 +0000 Subject: [PATCH] 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 Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Grady Wong Co-committed-by: Grady Wong --- modules/config/login.go | 2 +- modules/task/login_create.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/config/login.go b/modules/config/login.go index 0e7c58a..1d98fc4 100644 --- a/modules/config/login.go +++ b/modules/config/login.go @@ -228,5 +228,5 @@ func (l *Login) GetSSHHost() string { return "" } - return u.Hostname() + return u.Host } diff --git a/modules/task/login_create.go b/modules/task/login_create.go index 7131e2f..f736877 100644 --- a/modules/task/login_create.go +++ b/modules/task/login_create.go @@ -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)