Skip to content

refactor(web): send GitHub image URLs in pull requests through github-media - #648

Merged
incognitojam merged 1 commit into
mainfrom
refactor/pull-request-images-use-github-media
Oct 6, 2026
Merged

incognitojam merged 1 commit into
mainfrom
refactor/pull-request-images-use-github-media

Conversation

@incognitojam

Copy link
Copy Markdown
Owner

Upstream pingdotgg#11706, already in the fork, loads GitHub-hosted images in pull request bodies through its github-media asset with the environment's gh credential. That covers private repositories, raw and blob links, asset branches and attachments. The fork's own pull request image path (fork #103 and #288) duplicated most of that with its own ref parsing, preview component and expanded-image dialog.

This narrows the fork's path to the one thing upstream doesn't do: a repository-relative image such as ![](docs/screenshot.png) is read from the pull request's head rather than the local checkout. Qualified GitHub URLs now take upstream's github-media path. The fork's image component and dialog are removed, and relative images render through the same Markdown asset image as every other description image, so they open in the same gallery. The revision field on the pull-request-file asset is removed, since the head is always refs/pull/<n>/head.

GitHub Enterprise blob and raw URLs on the pull request's host now load directly in the browser, as they do upstream, because github-media covers github.com only. Relative images still work on Enterprise.

The ledger entry now describes only relative images, and the source control guide says relative paths are read from the pull request head.

Verification

In the web app on this branch, with real fork pull requests open in the pull request panel:

Not verified in a running app: relative image paths, because no available pull request uses one. pullRequestMarkdown.logic, PullRequestService, GitHubPullRequestCli and AssetAccess tests cover how they are resolved and fetched (407 tests across the five touched files pass). Server, contracts and web typecheck are clean.


Written by an agent (Claude Code, claude-opus-5-5).

Pull request descriptions now resolve only repository-relative images
through the fork's pull-request-file asset, read at the pull request
head. Qualified github.com blob, raw, asset-branch and attachment URLs
fall through to the upstream github-media path, which already fetches
them with the gh credential at their named revision.

Removed:
- The ref and path parsing for blob and raw URLs, the browser fallback
  for guessed ref splits, and the optional revision on the
  pull-request-file asset, provider read and gh contents call.
- Same-host blob and raw handling for GitHub Enterprise hosts. It
  depended on that ref parsing; relative images on Enterprise still
  resolve because the head read uses the project's own host.
- The pull request markdown's own image renderer and expanded-image
  dialog. ChatMarkdown's imageRenderer prop becomes imageAssetResource,
  so relative images render through the shared asset image and open in
  the same gallery as every other description image.

The ledger entry, its tests and the user guide line now describe the
relative-path scope only.
@github-actions github-actions Bot added the size:L label Oct 6, 2026
@incognitojam
incognitojam merged commit c68a94d into main Oct 6, 2026
18 checks passed
@incognitojam
incognitojam deleted the refactor/pull-request-images-use-github-media branch October 6, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant