fix(git): keep IPv6 brackets in submodule web links (#39186)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Zhaoqi Xu
2026-08-31 11:29:18 +00:00
committed by GitHub
co-authored by wxiaoguang
parent 7c93ead628
commit 7c36ae7668
2 changed files with 15 additions and 3 deletions
+8
View File
@@ -264,4 +264,12 @@ func TestMakeRepositoryBaseLink(t *testing.T) {
u, err = ParseRepositoryURL(t.Context(), "git+ssh://other:123/owner/repo.git")
assert.NoError(t, err)
assert.Equal(t, "https://other/owner/repo", MakeRepositoryWebLink(u))
u, err = ParseRepositoryURL(t.Context(), "git+ssh://[::1]/owner/repo.git")
assert.NoError(t, err)
assert.Equal(t, "https://[::1]/owner/repo", MakeRepositoryWebLink(u))
u, err = ParseRepositoryURL(t.Context(), "git+ssh://[::1]:2222/owner/repo.git")
assert.NoError(t, err)
assert.Equal(t, "https://[::1]/owner/repo", MakeRepositoryWebLink(u))
}