Show inline images on GitHub #87

Closed
opened 2026-10-09 09:36:02 -05:00 by deadstyle · 2 comments
Owner

Problem

On GitHub, images in PR and issue bodies always show as 🖼 alt links, because the adapter can't open them. Parent: #83. Depends on #84; pick this up after #84 merges.

Acceptance criteria

  • An image hosted on the connected GitHub host that stands alone in a top-level paragraph draws inline in the Details pane, as on Forgejo, including for private repos (design.md → Details: Images).
  • Images on other hosts, and every case design.md lists as staying a link, stay a link (design.md → Details: Images).
  • The token is never sent off the session's host (ADR 0016).

Plan

Check first: GitHub serves pasted images as https://github.com/user-attachments/assets/<id>, which redirect to signed *.githubusercontent.com URLs. Confirm with curl -sI and a token whether a private repo's asset opens with the API token. If it doesn't, comment the finding here and implement the public-repo case only. If no case works, close this ticket as won't-do with the evidence, which matches design.md's "everywhere else, stays a link".

If it works: implement forge.AssetReader on the GitHub adapter, mirroring internal/forge/gitea/assets.go. Same-origin check against the web root (github.com, not api.github.com), drop Authorization on any off-origin hop, and redact query strings in errors. GitHub's drag-and-drop inserts an HTML <img> tag, which design.md already says stays a link. Only Markdown ![]() images draw.

Context

ADR 0016 (inline images). internal/forge/gitea/assets.go, internal/forge/origin.go (SameOrigin), forge.ActAssets in can.go.

Out of scope

Rendering HTML <img> tags (design.md keeps those as links).

## Problem On GitHub, images in PR and issue bodies always show as `🖼 alt` links, because the adapter can't open them. Parent: #83. **Depends on #84**; pick this up after #84 merges. ## Acceptance criteria - An image hosted on the connected GitHub host that stands alone in a top-level paragraph draws inline in the Details pane, as on Forgejo, including for private repos *(design.md → Details: Images)*. - Images on other hosts, and every case design.md lists as staying a link, stay a link *(design.md → Details: Images)*. - The token is never sent off the session's host *(ADR 0016)*. ## Plan **Check first:** GitHub serves pasted images as `https://github.com/user-attachments/assets/<id>`, which redirect to signed `*.githubusercontent.com` URLs. Confirm with `curl -sI` and a token whether a private repo's asset opens with the API token. If it doesn't, comment the finding here and implement the public-repo case only. If no case works, close this ticket as won't-do with the evidence, which matches design.md's "everywhere else, stays a link". If it works: implement `forge.AssetReader` on the GitHub adapter, mirroring `internal/forge/gitea/assets.go`. Same-origin check against the web root (github.com, not api.github.com), drop `Authorization` on any off-origin hop, and redact query strings in errors. GitHub's drag-and-drop inserts an HTML `<img>` tag, which design.md already says stays a link. Only Markdown `![]()` images draw. ## Context ADR 0016 (inline images). `internal/forge/gitea/assets.go`, `internal/forge/origin.go` (`SameOrigin`), `forge.ActAssets` in `can.go`. ## Out of scope Rendering HTML `<img>` tags (design.md keeps those as links).
Author
Owner

🤖 Check done (2026-10-09). Public repo: https://github.com/user-attachments/assets/<id> answers 302 to a signed github-production-user-asset-*.s3.amazonaws.com URL, with or without a token, and following it gives 200 with the file. Private repo: no private repo on the test account has an attachment, so it couldn't be tested live. GitHub is widely reported to serve private-repo attachments only to a browser session, not to API tokens. Per the plan, this ticket implements the public case: the same-origin check against the web root (github.com) and the token dropped on the S3 hop. A private-repo image that 404s stays a link, as design.md → Images already says for a failed load.

🤖 Check done (2026-10-09). Public repo: `https://github.com/user-attachments/assets/<id>` answers 302 to a signed `github-production-user-asset-*.s3.amazonaws.com` URL, with or without a token, and following it gives 200 with the file. Private repo: no private repo on the test account has an attachment, so it couldn't be tested live. GitHub is widely reported to serve private-repo attachments only to a browser session, not to API tokens. Per the plan, this ticket implements the public case: the same-origin check against the web root (github.com) and the token dropped on the S3 hop. A private-repo image that 404s stays a link, as design.md → Images already says for a failed load.
Author
Owner

🤖 merged: #91

🤖 merged: https://git.bobparsons.dev/deadstyle/lazyforge/pulls/91
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
deadstyle/lazyforge#87
No description provided.