diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b8d4dfb25..829ea59c1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixes +- Recognize `*.ghe.com` URLs as `github_enterprise` VCS provider ([#3127](https://github.com/getsentry/sentry-cli/pull/3127)). - Fixed a bug where the `dart-symbol-map` command did not accept the `--url` argument ([#3108](https://github.com/getsentry/sentry-cli/pull/3108)). - Add timeout to `build upload` polling loop to prevent infinite loop when server returns unexpected state ([#3118](https://github.com/getsentry/sentry-cli/pull/3118)). diff --git a/src/utils/vcs.rs b/src/utils/vcs.rs index d72df090d8..948c35a0f9 100644 --- a/src/utils/vcs.rs +++ b/src/utils/vcs.rs @@ -220,6 +220,12 @@ impl VcsUrl { fn extract_provider_name(host: &str) -> &str { let trimmed = host.trim_end_matches('.'); + + // GitHub Enterprise Server uses *.ghe.com domains + if trimmed.ends_with(".ghe.com") { + return "github_enterprise"; + } + trimmed.rsplit('.').nth(1).unwrap_or(trimmed) } @@ -1085,6 +1091,13 @@ mod tests { // Test edge case with trailing dots assert_eq!(extract_provider_name("github.com."), "github"); + // Test GitHub Enterprise Server (*.ghe.com) + assert_eq!(extract_provider_name("foo.ghe.com"), "github_enterprise"); + assert_eq!( + extract_provider_name("mycompany.ghe.com"), + "github_enterprise" + ); + // Test subdomain cases - we want the part before TLD, not the subdomain assert_eq!(extract_provider_name("api.github.com"), "github"); assert_eq!(extract_provider_name("ssh.dev.azure.com"), "azure"); @@ -1125,6 +1138,15 @@ mod tests { get_provider_from_remote("https://source.developers.google.com/p/project/r/repo"), "google" ); + // Test GitHub Enterprise Server (*.ghe.com) + assert_eq!( + get_provider_from_remote("https://foo.ghe.com/bar/baz.git"), + "github_enterprise" + ); + assert_eq!( + get_provider_from_remote("git@mycompany.ghe.com:org/repo.git"), + "github_enterprise" + ); // Test edge case with trailing dot in hostname assert_eq!( get_provider_from_remote("https://github.com./user/repo"),