-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the bug
When using the GitHub integration, images attached to issue descriptions or comments in Huly are visible within Huly but do not render on the GitHub side. Only the text content syncs -- images appear as broken links or are invisible.
This affects both issue descriptions and comments, in both directions of sync (Huly -> GitHub).
Steps to reproduce
- Connect a GitHub repository via the GitHub integration
- Create or edit an issue in Huly
- Paste or attach an image in the issue description or a comment
- Observe: the image renders correctly in Huly
- Check the same issue on GitHub: only the text appears, the image is missing/broken
Expected behavior
Images should be visible on both sides. At minimum, they should render as accessible image URLs in the GitHub markdown.
Root cause
The infrastructure to fix this already exists in the codebase but was never wired in.
When Huly syncs content to GitHub, getMarkdown() in services/github/pod-github/src/worker.ts (line 237) converts Huly markup to GitHub-flavored markdown. Images become URLs pointing back to the Huly server:

These URLs require authentication. When GitHub's Camo image proxy tries to fetch them (unauthenticated), it fails, so images don't render.
The fix code exists but is dead code:
appendGuestLinkToImageinservices/github/pod-github/src/sync/guest.ts(line 96) correctly stamps a guest JWT token onto image markup nodesmarkupToMarkdowninservices/github/pod-github/src/markdown/index.ts(line 62) accepts apreprocessorcallback and invokes it on the AST before serialization- The serializer in
foundations/core/packages/text-markdown/src/serializer.ts(line 177) already checks forattrs.tokenand appends&token=to the URL when present
The gap: none of the 7 getMarkdown() call sites pass a preprocessor. The appendGuestLinkToImage function is never imported or called outside of guest.ts itself.
Affected call sites
All of these call getMarkdown() without a preprocessor:
| File | Line | Context |
|---|---|---|
sync/issues.ts |
~780 | Issue creation |
sync/issues.ts |
~205 | Issue edit event |
sync/comments.ts |
~357 | Comment update |
sync/comments.ts |
~433 | Comment creation |
sync/issueBase.ts |
~487 | Issue description push |
sync/issueBase.ts |
~584 | Stored markdown after sync |
sync/issueBase.ts |
~364 | Conflict resolution |
Suggested fix
The simplest fix would be to add a default preprocessor in getMarkdown() itself (worker.ts line 237), so all callers automatically get guest tokens on images:
async getMarkdown(text?: string | null, preprocessor?: (nodes: MarkupNode) => Promise<void>): Promise<string> {
if (text == null) {
return ''
}
return await markupToMarkdown(
text ?? '',
concatLink(this.getBranding()?.front ?? config.FrontURL, `/browse/?workspace=${this.workspace.uuid}`),
concatLink(this.getBranding()?.front ?? config.FrontURL, `/files/${this.workspace.uuid}/`),
preprocessor ?? (async (nodes) => { appendGuestLinkToImage(nodes, this.workspace.uuid) })
)
}This would make all 7 call sites emit image URLs with &token=<guest-jwt>, allowing GitHub's Camo proxy to fetch them.
Note: there's also a // TODO storage URL comment on line 244 of worker.ts acknowledging this area needs work.
Environment
- Huly version: v0.7.315 (self-hosted)
- Verified the dead code still exists on main branch
- Affects both self-hosted and likely cloud Huly (auth requirement)
Additional context
For self-hosted instances, even with guest tokens, the Huly server must be publicly accessible for GitHub's image proxy to reach it. A more robust long-term solution would be to upload images to GitHub as user attachments via the GitHub API, but the guest token fix would suffice for most deployments.