Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).

Expand Down
22 changes: 22 additions & 0 deletions src/utils/vcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Copy link
Member

@szokeasaurusrex szokeasaurusrex Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some optional improvements we could do here (both can wait for a separate PR):

  1. We could extract "github_enterprise" to a constant.

  2. We could define an enum for the supported providers, and include a fallback for unknown providers, like so:

    enum VcsProvider {
        Github,
        GithubEnterprise
        Gitlab,
        Other(String), // or &str
    }

    Then, we would return the enum from this method. We would probably need to add some serialization logic on the enum, as well as a method to convert an arbitrary string to the enum (probably a From<&str> impl works), so I guess there's some added complexity, but it would be clear what providers we support natively.

}

trimmed.rsplit('.').nth(1).unwrap_or(trimmed)
}

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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"),
Expand Down