Skip to content

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

@spatialy

Description

@spatialy

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

  1. Connect a GitHub repository via the GitHub integration
  2. Create or edit an issue in Huly
  3. Paste or attach an image in the issue description or a comment
  4. Observe: the image renders correctly in Huly
  5. 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:

![image](https://huly.example.com/files/<workspace>/<file-id>?file=<file-id>)

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:

  1. appendGuestLinkToImage in services/github/pod-github/src/sync/guest.ts (line 96) correctly stamps a guest JWT token onto image markup nodes
  2. markupToMarkdown in services/github/pod-github/src/markdown/index.ts (line 62) accepts a preprocessor callback and invokes it on the AST before serialization
  3. The serializer in foundations/core/packages/text-markdown/src/serializer.ts (line 177) already checks for attrs.token and 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions