Repository navigation
refactor(web): send GitHub image URLs in pull requests through github-media - #648
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream pingdotgg#11706, already in the fork, loads GitHub-hosted images in pull request bodies through its
github-mediaasset with the environment'sghcredential. 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
is read from the pull request's head rather than the local checkout. Qualified GitHub URLs now take upstream'sgithub-mediapath. 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. Therevisionfield on thepull-request-fileasset is removed, since the head is alwaysrefs/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-mediacovers 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:
<img>tags pointing atraw.githubusercontent.com. They load through thegithub-mediaasset URL.user-attachmentsimages load the same way.Not verified in a running app: relative image paths, because no available pull request uses one.
pullRequestMarkdown.logic,PullRequestService,GitHubPullRequestCliandAssetAccesstests 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).