fix(pr): GitCafe attachments render in pull request bodies#31741

merged1
main
fix/pr-relative-attachments
opened4d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 4d ago

Problem

GitCafe writes uploaded screenshots into PR bodies as root-relative links: ![…](/api/attachments/attach_…). In the PR panel, web classified the path as a file on the server's machine, and mobile rejected it for not being http(s). Both showed "Image unavailable" for every GitCafe attachment, for example on #31251.

Change

  • New resolveChangeRequestMediaUrl in client-runtime: a root-relative URL in a change request body means the forge's origin, never a local path. It ignores protocol-relative URLs (//, /\) and leaves workspace-relative paths alone.
  • Web: a remark plugin, added to the per-repository PR markdown plugin list, rewrites image and definition URLs against the repository URL. Markdown offsets are unchanged, so checkbox write-back still works.
  • Mobile: PullRequestMarkdownRepository passes the change request URL down. Image render, press-to-preview and the gallery resolve hrefs the same way.

Attachments on private GitCafe repos would still need an authenticated fetchMedia in the GitCafe driver, as GitHub has. Not done here; public attachments load directly.

Verification

  • vp run check:changed: all pass. New regression rows in pullRequestMarkdown.test.ts.
  • Web dev server, PR panel on #31251:

Mobile was not run on a device. It shares the resolver and only changes which href it passes.

Opus 5.5 via Claude Code in T3 Code.

🤖 Generated with Claude Code

Checks

1 failing · 24 successful · 14 skipped
Some checks failed

Failing1

a66ab42

Added 1 commit

  • fix(pr): GitCafe attachments render in pull request bodiesa66ab42
Synced from GitHub

Approvability

Verdict: Approved at a66ab42

Macroscope's review found this PR approvable — Root-relative PR attachments now resolve against the forge origin on web and mobile instead of being treated as local paths. The change is limited to markdown rendering and previews, with no data, permission, or product-default changes.

You can add or adjust custom eligibility rules. Learn more.