[Bug]: Pull request images on GitHub Enterprise Server don't load (uploads and committed files)
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Sign in to a GitHub Enterprise Server host with
gh auth login --hostname ghe.example.com. - Open a pull request from that host in the pull request panel. Its description has:
- an uploaded image:
https://ghe.example.com/user-attachments/assets/<id> - a committed image:
https://ghe.example.com/OWNER/REPO/blob/<sha>/docs/demo.gif?raw=true
- an uploaded image:
Expected behavior
Both images render, as they do on GitHub's own page and as github.com images do in T3 Code.
Actual behavior
Both show "Image unavailable". The description text loads fine.
gitHubMediaUrl only claims github.com hosts, so the client loads these URLs directly with no credential, and the server answers with a redirect to /login. #33811 fixes committed files by reading them from the raw. subdomain, and leaves uploads out.
Checked against the server with the gh token for that host:
| Request | Result |
|---|---|
blob/<sha>/demo.gif?raw=true with the token |
302 to /login |
https://raw.ghe.example.com/OWNER/REPO/<sha>/docs/demo.gif (what #33811 reads) |
the host does not resolve |
GET /api/v3/repos/OWNER/REPO/contents/docs/demo.gif?ref=<sha> with Accept: application/vnd.github.raw |
200, the GIF |
user-attachments/assets/<id> with the token, redirects not followed |
302 to a signed https://ghe.example.com/storage/<id>?… |
| that signed URL with the token | 404 |
| that signed URL without the token | 200 image/png; with Range, 206 |
So committed files need the Contents API on a server without a raw. host, and an upload needs the token on its first request only: the signed URL is on the same host and refuses a request that also carries the token.
#34367 is the same upload gap on *.ghe.com.
Impact
Major degradation or frequent failure
Version or commit
main @ 2482b03a01
Environment
GitHub Enterprise Server 3.21.4, signed in with gh.
I tried to reproduce this on the current build and could not.
On origin/main 60c3b222db, in packages/source-control-github, I added assertions to the existing 'fetches every spelling of an upload or committed file from one canonical URL' test in src/shared/definition.test.ts. They expect an Enterprise Server upload (https://ghe.example.com/user-attachments/assets/vp test run src/shared/definition.test.ts -t "every spelling" gives 1 failed: expected undefined to be 'https://ghe.example.com/user-attachments/...', because definition.mediaUrl returns null for any non-github.com host. Without a claim, PullRequestMarkdown renders the URL as a plain with no credential. A comment on #34367 shows that in real Chromium on main. I did not watch the final step (the Enterprise host answering with a 302 to /login, so the image shows 'Image unavailable') because that needs a GitHub Enterprise Server instance with a gh login, which no worker has. Pushed as factory/repro-35439 (a3b1ae69d1).
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.
[!NOTE] 🤖 Claude Opus 5.5 responding on behalf of GuardedAirplane
This still happens on T3 Code 0.1.9 (web) against GitHub Enterprise Server 3.21.4.
- Sign in with
gh auth login --hostname ghe.example.com. - On that server, open a pull request from the branch
test/pr-imageswhose description has three images:- an image dragged into the editor (
https://ghe.example.com/user-attachments/assets/<id>) 
- an image dragged into the editor (
- Open it in the pull request panel.
All three show "Image unavailable". With a dev build of #35443's head on the same machine and server, all three render. The final step the pipeline could not watch is now also covered by a test in #35443 against an emulated server.
Opus 5.5 on behalf of Emanuel
Same on GitHub Enterprise Server 3.21.7 (T3 Code Desktop 0.1.13, Windows). Release-asset images and videos of a private repository, linked as https://ghe.example.com/<owner>/<repo>/releases/download/<tag>/<file>, show "Image unavailable" / "Video unavailable" in a PR comment.
As on github.com, that web URL returns 404 even with the gh token. GET https://ghe.example.com/api/v3/repos/<owner>/<repo>/releases/assets/<id> with Accept: application/octet-stream and the token returns 302 to a signed https://media.ghe.example.com/releases/…?token=… URL, which serves the file (200 application/octet-stream).
To cover Enterprise Server, the fix in #25027 would need the change request's host (as #35443 passes it) and the /api/v3 API base.