Skip to content

Comments

Fix parseGitHostURL appending /api/v4/ to non-GitLab services#202

Merged
amitsaha merged 1 commit intoamitsaha:masterfrom
rdowavic:fix/parse-git-host-url
Feb 21, 2026
Merged

Fix parseGitHostURL appending /api/v4/ to non-GitLab services#202
amitsaha merged 1 commit intoamitsaha:masterfrom
rdowavic:fix/parse-git-host-url

Conversation

@rdowavic
Copy link

Summary

  • parseGitHostURL was appending /api/v4/ to custom host URLs for all services, but this is only correct for GitLab
  • This broke GitHub Enterprise (which expects /api/v3/, handled by the go-github library itself) and Bitbucket custom hosts
  • Forgejo already had a special-case workaround for this (Support for Forgejo self-hosted instance #193) — this fix replaces that with the correct general approach: only append /api/v4/ for GitLab, return the plain URL for everything else

Test plan

  • All existing tests pass (go test ./...)
  • Updated TestNewClient to assert GitHub Enterprise gets the plain URL (not /api/v4/)
  • GitLab custom host test still asserts /api/v4/ is appended

Fixes #195

Only GitLab requires /api/v4/ appended to custom host URLs. Previously
this was appended for all services (with a special case to skip Forgejo),
which broke GitHub Enterprise and Bitbucket custom host URLs.

Fixes amitsaha#195
@amitsaha amitsaha merged commit 954a3de into amitsaha:master Feb 21, 2026
6 checks passed
@amitsaha
Copy link
Owner

thanks @rdowavic 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify custom git host support for other providers

2 participants