Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Sign in to a GitHub Enterprise Cloud tenant with
gh auth login --hostname <tenant>.ghe.com. The tenant's organization should require enterprise sign-in (SAML/SSO), and the account must be able to read a private repository there. - In that repository, open a pull request whose description contains either:
- an uploaded image (
https://<tenant>.ghe.com/user-attachments/assets/<uuid>), or - an image committed to the repository (
https://<tenant>.ghe.com/<owner>/<repo>/blob/<ref>/<path>.png?raw=true).
- an uploaded image (
- Open the pull request in T3 Code's built-in pull request viewer.
Expected behavior
Both images render, as they do for equivalent pull requests on github.com. The server fetches them with the gh credential for the pull request's host.
Actual behavior
Both images appear broken. The pull request's text, comments and other details on the same host load normally.
Cause (from source): gitHubMediaUrl in packages/source-control-github/src/shared/gitHubMedia.ts only recognizes github.com, www.github.com, raw.githubusercontent.com and media.githubusercontent.com. For any other host it returns null. The image is then rendered as a plain <img src>, and the client has no session for the Enterprise host. Running the function from v0.1.8 (identical on main) gives:
https://github.com/user-attachments/assets/<uuid> -> { fetchUrl: "https://github.com/user-attachments/assets/<uuid>", ... }
https://github.com/o/r/blob/main/a.png?raw=true -> { fetchUrl: "https://raw.githubusercontent.com/o/r/main/a.png", ... }
https://example.ghe.com/user-attachments/assets/<uuid> -> null
https://example.ghe.com/o/r/blob/main/a.png?raw=true -> null
https://ghes.example.com/user-attachments/assets/<uuid> -> null
packages/source-control-github/src/server/gitHubMediaFetch.ts also assumes github.com, so accepting the URL in gitHubMediaUrl alone would not fix it:
- It reads the credential with
credentials.get("github.com")rather than the media's host. uploadRepositoryrequireshostname === "github.com".- The SAML fallback
renderSignedUrlposts tomarkdownonhost: "github.com". It only accepts a signed URL onprivate-user-images.githubusercontent.comthat has ajwtparameter. GITHUB_CREDENTIALED_MEDIA_HOSTSonly lists github.com hosts.
How a *.ghe.com tenant behaves (checked with curl, using the gh token for the tenant):
| Request | Result |
|---|---|
GET https://<tenant>.ghe.com/user-attachments/assets/<uuid>, no auth |
302 to /login |
same, Authorization: Bearer <gh token> |
200 text/html (the enterprise sign-in page, like the github.com SAML case) |
POST https://api.<tenant>.ghe.com/markdown with , mode: gfm, context: <owner>/<repo> |
<img src> is https://objects-origin.<tenant>.ghe.com/... with X-Amz-* signature parameters (X-Amz-Expires=300). It is not private-user-images.githubusercontent.com and has no jwt parameter. |
GET that signed URL, no auth |
307 to an Azure Blob Storage host, then 200 image/png |
GET https://<tenant>.ghe.com/<owner>/<repo>/blob/<ref>/<path>.png?raw=true, bearer |
302 to /login |
GET https://raw.<tenant>.ghe.com/<owner>/<repo>/<ref>/<path>.png, bearer |
200 image/png |
GET https://api.<tenant>.ghe.com/repos/<owner>/<repo>/contents/<path>?ref=<ref>, Accept: application/vnd.github.raw, bearer |
200 |
So the same approach as on github.com works on *.ghe.com, with tenant-specific hosts:
- Rewrite repository file links to
raw.<tenant>.ghe.com, the equivalent ofraw.githubusercontent.com. - Resolve uploads through the tenant's markdown render endpoint and accept its
objects-origin.<tenant>.ghe.comsigned URL. - Look up the credential for the tenant host.
Credential lookup (GitHubCredentials) and pull request host detection already handle *.ghe.com. This looks like a gap in the media path only, not missing Enterprise support.
Impact
Minor bug or occasional failure
Version or commit
0.1.8 (desktop). The media files are unchanged on main @ a577e94.
Environment
macOS, T3 Code desktop 0.1.8, GitHub Enterprise Cloud with data residency (*.ghe.com) with enterprise sign-in, gh authenticated to the tenant
Logs or stack traces
Not collected. According to the source, these URLs never reach the server media fetch; the client loads them directly, so no server log entry is expected.
Workaround
Open the pull request in a browser that is signed in to the Enterprise tenant.
Not verified
- GitHub Enterprise Server (self-hosted) was not tested. It goes through the same
gitHubMediaUrlpath (third line above), but its raw-file and signed-upload hosts may differ from*.ghe.com. - A
*.ghe.comorganization without enterprise sign-in was not tested. - No patch was written or tested. The host behaviour above was checked with curl, not through a modified T3 Code build.
Activity
juliusmarminge commentedon Nov 11, 2026
I tried to reproduce this on the current build and could not.
Not seen in a running app: that needs a GitHub Enterprise Cloud (*.ghe.com) tenant with enterprise sign-in and a private repo, which no worker has. On origin/main d50a6fd I confirmed the reporter's source analysis and added assertions to the existing 'fetches every spelling of an upload or committed file from one canonical URL' test in packages/source-control-github/src/shared/definition.test.ts. definition.mediaUrl(new URL('https://acme.ghe.com/user-attachments/assets/')) returns null on main (AssertionError: expected undefined to be 'https://acme.ghe.com/user-attachments/...'). A blob ?raw=true link on acme.ghe.com is also expected to map to https://raw.acme.ghe.com/owner/repo/main/docs/shot.png. Ran with
vp test run src/shared/definition.test.ts -t "every spelling"in packages/source-control-github: 1 failed. Pushed as factory/repro-34367 (9d6ac35).Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.
FreshlyBrewedCode commentedon Nov 12, 2026
Thanks for looking into this, and for the unit test on
factory/repro-34367. This still happens for me on desktop 0.1.8 (macOS). Below is a reproduction of the visible symptom that doesn't need a GitHub Enterprise tenant.Repro without a tenant (real Chromium, current
main@ ee90bdc)This adds one test to
apps/web/src/components/pullRequest/PullRequestMarkdown.browser.test.tsx. It renders a pull request body with the realPullRequestMarkdowncomponent and checks how each image is loaded: through the server's credentialed media fetch, or as a plain<img src>.cd apps/web && vp test run --project browser src/components/pullRequest/PullRequestMarkdown.browser.test.tsx -t "fetched by the server"So in the running app, Enterprise images are loaded directly by the webview, with no credential. The issue body shows what an Enterprise host does with such a request:
302to/login. The webview has no session for that host, so the image breaks. A tenant is only needed to watch that last step, not to reproduce the bug.Could you reopen this? I'm happy to test a fix against a real
*.ghe.comtenant.