fix: correct "go get" URL ssh scheme, fix form binding (#39674, #39528) (#39676)

* Backport #39674
* Fix form binding errors (found by #39528)
* Fix #39680

---------

Co-authored-by: Roland Singer <10167163+r0l1@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot
2026-10-08 05:30:59 -07:00
committed by GitHub
parent 793e77b073
commit 175bc89bf9
9 changed files with 33 additions and 25 deletions
+5
View File
@@ -58,6 +58,11 @@ func TestGoGetForSSH(t *testing.T) {
</html>`, setting.AppDomain, setting.HTTPPort, setting.AppURL, setting.SSH.Domain, setting.SSH.Port)
assert.Equal(t, expected, resp.Body.String())
// go rejects scp-style addresses, so the standard port must still produce an ssh:// URL
defer test.MockVariableValue(&setting.SSH.Port, 22)()
resp = MakeRequest(t, req, http.StatusOK)
assert.Contains(t, resp.Body.String(), fmt.Sprintf(`git ssh://git@%s/blah/glah.git">`, setting.SSH.Domain))
}
// TestGoGetPrivateRepoBranchNotLeaked ensures the go-get meta endpoint does not disclose a