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

Fix #38016
Backport #38026
This commit is contained in:
Lunny Xiao
2026-06-18 11:34:58 +03:00
committed by GitHub
parent 6fb96fcfdf
commit 0b9623e188
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 {