hack: Add support for iap:// URLs (#59709)

See inline comment for reasoning.

## Test plan

Added a test.
This commit is contained in:
Erik Seliger 2024-01-23 20:10:08 +01:00 committed by GitHub
parent e79319271a
commit b98e9aeabf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View File

@ -67,6 +67,12 @@ var schemes = map[string]struct{}{
"rsync": {},
"file": {},
"perforce": {},
// This is not an officially supported git protocol, and it will not work
// without adding an override to the global git config for iap:// to https://.
// This has been added as a response to a customer issue where their GitLab
// instance reports a URL with the iap:// scheme.
// https://github.com/sourcegraph/accounts/issues/2379
"iap": {},
}
func parseScheme(rawurl string) (*URL, error) {

View File

@ -215,6 +215,12 @@ func TestParseURL(t *testing.T) {
formatStdlib, "perforce", "admin:pa$$word", "ssl:192.168.1.100:1666", "//Sourcegraph/",
"perforce://admin:pa$$word@ssl:192.168.1.100:1666//Sourcegraph/", "",
),
// iap://
newParseURLTest(
"iap://admin:pa$$word@gitlab.sgdev.org/test/repo.git",
formatStdlib, "iap", "admin:pa$$word", "gitlab.sgdev.org", "/test/repo.git",
"iap://admin:pa$$word@gitlab.sgdev.org/test/repo.git", "",
),
}
for _, tt := range tests {