Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
adding subdomain for uploads too
  • Loading branch information
tonytrg committed Oct 14, 2025
commit 1a4998ca51ad671d3e621f68584e5570b6f34c2e
16 changes: 12 additions & 4 deletions internal/ghmcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"time"

"github.com/github/github-mcp-server/pkg/errors"
"github.com/github/github-mcp-server/pkg/github"

Check failure on line 18 in internal/ghmcp/server.go

View workflow job for this annotation

GitHub Actions / lint

could not import github.com/github/github-mcp-server/pkg/github (-: # github.com/github/github-mcp-server/pkg/github
mcplog "github.com/github/github-mcp-server/pkg/log"
"github.com/github/github-mcp-server/pkg/raw"
"github.com/github/github-mcp-server/pkg/translations"
Expand Down Expand Up @@ -364,14 +364,22 @@
return apiHost{}, fmt.Errorf("failed to parse GHES GraphQL URL: %w", err)
}

uploadURL, err := url.Parse(fmt.Sprintf("%s://%s/api/uploads/", u.Scheme, u.Hostname()))
// Check if subdomain isolation is enabled
// See https://docs.github.com/en/enterprise-server@3.17/admin/configuring-settings/hardening-security-for-your-enterprise/enabling-subdomain-isolation#about-subdomain-isolation
hasSubdomainIsolation := checkSubdomainIsolation(u.Scheme, u.Hostname())

var uploadURL *url.URL
if hasSubdomainIsolation {
// With subdomain isolation: https://uploads.hostname/
uploadURL, err = url.Parse(fmt.Sprintf("%s://uploads.%s/", u.Scheme, u.Hostname()))
} else {
// Without subdomain isolation: https://hostname/api/uploads/
uploadURL, err = url.Parse(fmt.Sprintf("%s://%s/api/uploads/", u.Scheme, u.Hostname()))
}
if err != nil {
return apiHost{}, fmt.Errorf("failed to parse GHES Upload URL: %w", err)
}

// Check if subdomain isolation is enabled
hasSubdomainIsolation := checkSubdomainIsolation(u.Scheme, u.Hostname())

var rawURL *url.URL
if hasSubdomainIsolation {
// With subdomain isolation: https://raw.hostname/
Expand Down
Loading