Skip to content

fix(github): apply guest token to images in markdown sync#10659

Open
dnplkndll wants to merge 1 commit intohcengineering:developfrom
ledoent:fix/github-image-guest-token
Open

fix(github): apply guest token to images in markdown sync#10659
dnplkndll wants to merge 1 commit intohcengineering:developfrom
ledoent:fix/github-image-guest-token

Conversation

@dnplkndll
Copy link
Contributor

Summary

Fixes #10516

  • appendGuestLinkToImage() in services/github/pod-github/src/sync/guest.ts stamps a guest JWT token onto image URLs before serialization to GitHub markdown
  • The function existed but was dead code — never called from getMarkdown()
  • This PR adds it as the default preprocessor via preprocessor ?? (async (nodes) => { appendGuestLinkToImage(nodes, this.workspace.uuid) }), so all 10+ call sites automatically get image token injection when no custom preprocessor is provided
  • The serializer at foundations/core/packages/text-markdown/src/serializer.ts:175-191 already handles attrs.token&token= in URLs

Test plan

  • Create a Huly issue with an inline image in a GitHub-connected project
  • Verify the synced GitHub issue shows the image (URL contains &token=<guest-jwt>)
  • Verify that call sites passing an explicit preprocessor still work as before (nullish coalescing preserves existing behavior)

🤖 Generated with Claude Code

…ing#10516)

The appendGuestLinkToImage function existed but was never called from
getMarkdown(). Add it as the default preprocessor so image URLs include
a guest JWT token, allowing them to render on GitHub.

Signed-off-by: Daniel Kendall <dkendall@ledoweb.com>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Don Kendall <kendall@donkendall.com>
@huly-github-staging
Copy link

Connected to Huly®: UBERF-15990

@dnplkndll
Copy link
Contributor Author

dnplkndll commented Mar 21, 2026

Verified on self-hosted instance

Tested on huly.hz.ledoweb.com with hardcoreeng/github:v0.7.382 + this fix applied.

Test: Issue created in Huly with inline image → synced to GitHub

Synced issue: ledoent/cad-plm#11 — image synced with guest JWT token, rendered via GitHub's camo proxy.

With fix (this PR): Image URL includes &token=<guest-jwt>HTTP 200 (image renders)

$ curl -sk -o /dev/null -w "%{http_code} %{content_type}" "<url>&token=eyJ..."
200 image/png

Without fix (no token): Same URL without &token=HTTP 401 (broken image)

$ curl -sk -o /dev/null -w "%{http_code}" "<url>"  
401

The appendGuestLinkToImage preprocessor correctly stamps guest JWT tokens on all image nodes in the markdown before serialization to GitHub. GitHub proxies the image through camo.githubusercontent.com which fetches it with the token → 200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Images in Huly issue comments don't appear on GitHub side (GitHub integration)

1 participant