fix: Fix the panic when ssh remote lfs endpoint parsing failure (#38026)

Fix #38016
This commit is contained in:
Lunny Xiao
2026-06-18 07:54:16 +02:00
committed by GitHub
parent 240d0efa7e
commit 64f3796567
7 changed files with 74 additions and 12 deletions
+18
View File
@@ -64,6 +64,24 @@ func TestDetermineEndpoint(t *testing.T) {
lfsurl: "git://gitlfs.com/repo",
expected: str2url("https://gitlfs.com/repo"),
},
// case 7
{
cloneurl: "ssh://git@git.com/owner/repo.git",
lfsurl: "",
expected: str2url("https://git.com/owner/repo.git/info/lfs"),
},
// case 8
{
cloneurl: "git@git.com:owner/repo.git",
lfsurl: "",
expected: str2url("https://git.com/owner/repo.git/info/lfs"),
},
// case 9
{
cloneurl: "",
lfsurl: "ssh://git@gitlfs.com/owner/repo.git/info/lfs",
expected: str2url("https://gitlfs.com/owner/repo.git/info/lfs"),
},
}
for n, c := range cases {