Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Private GitLab uploads do not load in MR descriptions #11412

OpenRasalas(GitHub profile, opens in a new tab) opened this issue 13 comments

Area

apps/web, apps/server

Steps to reproduce

  1. Sign in to a self-hosted GitLab instance with glab and add a private repository to T3 Code.
  2. Create a merge request and upload a PNG and a short MP4 to its description using GitLab's upload UI.
  3. Open that MR in T3 Code's pull request panel.

GitLab stores these uploads as relative /uploads/<secret>/<filename> references. The same problem affects copied project-ID upload links. The private test repository is on a local network, so it cannot be shared publicly; the steps above reproduce it with another GitLab installation.

Expected behavior

The uploaded image is visible. The video plays and supports seeking using the environment's GitLab login.

Actual behavior

The image is unavailable and the video cannot play. Relative image paths can be mistaken for workspace files, and anonymous browser requests cannot retrieve private uploads.

Private GitLab MR with unavailable image and video

Impact

Major degradation for MR descriptions that use screenshots or recordings to explain changes.

Version and environment

Reproduced on main at e816064945, web client on macOS, private self-hosted GitLab. GitLab returns uploaded PNG/MP4 files as application/octet-stream. The reproduction's configured login host differs from GitLab's canonical repository URL.

#23501 implements the fix (replacing #11374, #15270 and #18793). #6600 describes the related GitHub image problem; #10775 is the existing GitHub-specific proposal.

Searched existing GitLab image reports before filing; no matching bug report found.

  1. Could a maintainer triage this? #18793 was closed because this issue hasn't been triaged yet. I missed that the contribution policy from #14480 now requires that for a fix of this size, so sorry for the extra round.

    It still reproduces on current main (511d20c6f2) against a private, self-hosted GitLab 19.4. The PR panel shows "Image unavailable" and "Video unavailable" for uploads in the MR description, for two reasons:

    • GitLab writes uploads as project-relative /uploads/<secret>/<name> links, which the clients treat as workspace paths.
    • A private project only serves uploads to a signed-in request. Without a session GitLab redirects to /users/sign_in.

    Proposed behavior: images and videos uploaded to a private project's MR description or comments render in the PR view on web, desktop and mobile. They load through the environment's glab login for that host and GitLab's upload API, the same way private GitHub attachments load through GitHubCredentials and GitHub's API since #11706 and #16321. Without a login, or on GitLab older than 17.4 (no upload API), they fall back to loading the upload URL directly, as today.

    #18793 implements this and includes before/after screenshots. Happy to change the approach if you'd prefer a different direction.

  2. Also reproduces on gitlab.com (SaaS), not just self-hosted. In a private project's MR, every /uploads/<secret>/<file> image in the description shows as unavailable in the PR panel, and an uploaded .mp4 doesn't play. Requesting the upload without a login returns 302 → /users/sign_in for both gitlab.com/<group>/<project>/uploads/… and gitlab.com/-/project/<id>/uploads/…. Fetching it with glab api projects/<id>/uploads/<secret>/<file> returns the file, so the approach in #18793 would fix it. +1 for triage.

  3. Additional user report on desktop v0.1.0: GitLab MR images are missing in both descriptions and comments.

    Environment:

    • T3 Code (Beta) desktop app: 0.1.0
    • Bundled local server: 0.1.0
    • macOS 26.6, Apple Silicon

    User-reported reproduction:

    1. Open a GitLab MR containing images in its description and comments.
    2. View the MR in T3 Code's desktop app.
    3. Images are not visible in either location.
    4. View the same MR directly in GitLab: the images are visible.

    Source inspection at release commit 81493efb71e8e8244f95d3e9f71d8369654ab151:

    • PullRequestMarkdown and ChatMarkdown support authenticated GitHub media.
    • Equivalent handling for GitLab uploads is absent.
    • MR comments use the same PullRequestMarkdown renderer.

    This is consistent with the reported issue. The failing image requests and their HTTP responses have not been captured, so the exact failure path in this installation remains unverified.


    Model: gpt-6.1-sol · Reasoning: medium · Harness: Codex Desktop

  4. Triaged as a bug; no duplicate found among the open issues from the last 90 days.

    Verification on Linux at 3b95e7831b stopped at reproduction step 1: this environment has no glab executable, stored GitLab login, or GitLab token. The reported private repository is not accessible here, so no browser reproduction or fix has been verified.

    Maintainer follow-up needs an environment signed in to a private GitLab test project with PNG/MP4 MR uploads. The existing report supplies the steps and version; no credentials should be posted here. Leaving this issue open.

  5. juliusmarminge added labelsneeds more info

  6. juliusmarminge removed labelsneeds more info

  7. This blocks our normal code-review workflow on self-hosted GitLab. We use screenshots and videos extensively as review evidence, but screenshots in MR comments show “Image unavailable” in T3 Code while the same attachments load correctly in GitLab. We have to leave T3 Code and open GitLab to actually review that evidence, which makes the MR view much less useful for us.

    We cannot share the screenshots or recordings publicly because they contain private project information, but we can help verify a fix against our self-hosted instance.

    Is #23501 still the intended implementation, and could this be prioritized? Restoring access to review evidence would let us do these reviews inside T3 Code.

  8. Tested the approach in #23501 against a private project on self-hosted GitLab 16.11.10. It can't fix this on GitLab older than 17.4:

    • GET /api/v4/projects/:id/uploads/:secret/:file with a valid glab token → 404 (the endpoint was added in 17.4)
    • GET /<group>/<project>/uploads/:secret/:file → 302 /users/sign_in with no auth, with Authorization: Bearer, and with PRIVATE-TOKEN

    So on GitLab older than 17.4, private uploads can't be fetched with a token at all, and the fallback to the plain upload URL only helps public projects. The PR still looks right for 17.4+. It might be worth saying in the docs or the fallback message that private-project media needs GitLab 17.4 or later.

  9. Note

    🤖 Claude Opus 5.5 responding on behalf of Rasalas

    @pedrocostadev Thanks for testing on 16.11, that matches what I see: the upload API only exists since GitLab 17.4, and older versions serve private uploads only to a signed-in browser session, not to a token. The docs in #23501 state the 17.4 requirement.

    @danddanddand If your instance runs GitLab 17.4 or later, testing #23501 against it would add another confirmation from a self-hosted setup.

  10. Also reproduces on T3 Code Desktop 0.1.8-nightly.20261105.4218 (macOS 27, arm64) with a private gitlab.com project and glab logged in. /uploads/<secret>/<file>.png images in MR descriptions don't render in the PR panel. Looking forward to #23501.

    Posted via T3 Code triage by Claude Code (Opus 5.5).

  11. tanstack-source added labelsbug

  12. Still reproduces on main at 49c3ab86 (2026-11-17), and in T3 Code desktop 0.1.10 against a private project on a self-hosted GitLab 19.x, for MR descriptions with screenshots and an .mp4. Below is what I checked against main, gitlab.com and #23501, because some of it changes what the fix needs.

    What main does today

    • Wrong base for relative links. In the PR panel, remarkChangeRequestMediaUrls (apps/web/src/components/pullRequest/pullRequestMarkdown.logic.ts) resolves root-relative image links against the instance origin. /uploads/<secret>/a.png becomes https://<host>/uploads/<secret>/a.png, and GitLab answers that with 302 → /users/sign_in even for a public project (table below).
    • No credentialed fetch. GitLab has no mediaUrl or fetchMedia; on main only source-control-github implements them.
    • GitLab's size attribute shows up as text. GitLab appends {width=… height=…} to uploads. The docs say it is always appended to pasted high-resolution PNGs since 17.1; pasted screenshots on gitlab.com carry it (e.g. gitlab-org/gitlab!271375); and on our 19.x instance every attachment added through the web editor has it, videos included. T3 has no attribute-list parsing, so ![a](/uploads/…/a.png){width=900 height=562} parses as an image followed by the literal text {width=900 height=562}. I checked this with unified 11, remark-parse 11 and remark-gfm 4.

    Upload URL forms, checked against gitlab.com today

    These are unauthenticated requests for an upload in a public gitlab-org/gitlab MR created today (!271600, project ID 278964):

    URLResult
    https://gitlab.com/uploads/<secret>/<file> (what main builds)302 → /users/sign_in
    https://gitlab.com/gitlab-org/gitlab/uploads/<secret>/<file> (project path)404
    https://gitlab.com/-/project/278964/uploads/<secret>/<file> (project ID)200 image/png
    https://gitlab.com/api/v4/projects/278964/uploads/<secret>/<file>200 application/octet-stream
    https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/uploads/<secret>/<file>200 application/octet-stream

    For an upload from February 2024 in the same project, the project-path URL still works (206).

    That matches gitlab-org/gitlab!156939:

    • GitLab has generated project-ID upload URLs since 17.1.
    • Uploads created on 17.2 or later are served only at /-/project/<id>/uploads/…. Older uploads keep their path-based URL.

    The upload API (GET /projects/:id/uploads/:secret/:filename, GitLab 17.4+):

    • accepts the numeric ID or the URL-encoded path;
    • needs only the Guest role;
    • answers a Range request for an .mp4 with 206, so seeking works;
    • always sends application/octet-stream, so the type has to come from the file name. sourceControlMediaResponse already falls back to that.

    Notes on #23501

    The authenticated path looks right to me: it fetches through the API with the glab token for that host only, follows redirects by hand without the token, and invalidates the token on a 401. Three gaps:

    1. The no-token fallback requests the URL that now 404s. With no token (gitlab.com signed out), or when the API refuses, fetchMedia falls back to request.url. That is the project-path URL resolveChangeRequestMediaUrl built, and for uploads created on 17.2+ it returns 404 even in a public project (table above).

      • Calling the upload API without a token works for public projects (200 above), so the fallback could try that first.
      • Only GitLab older than 17.4 needs the web URL, and that should use the /-/project/<id>/ form. target_project_id is already in the MR JSON.
    2. {width=… height=…} still renders as text. #23501 doesn't touch it. A small remark step could do it:

      • remove a {…} text node that directly follows an image;
      • put width/height on the image's hProperties, which reuses the sizing ChatMarkdown already applies through authoredImageSizeStyle.

      It only affects rendering, so editing a description or ticking a checkbox still writes GitLab's text back unchanged.

    3. The PR conflicts with main (mergeable: CONFLICTING).

    Still not covered, as the PR says: installs under a relative URL root (https://host/gitlab/…) and raw <img src="/uploads/…">. On GitLab older than 17.4 there's no upload API, so private uploads can't be fetched with a token (shown above on 16.11).

    Other self-hosted forges

    Each open-source self-hosted forge T3 supports has the same symptom and its own track, all built on mediaUrl and fetchMedia:

    ForgeLink its editor writesIssueFix PR
    GitLab (self-managed, gitlab.com)/uploads/<secret>/<file>, relative to the project, plus {width=… height=…}#11412#23501
    Forgejo (incl. Codeberg)/attachments/<uuid>, relative to the origin#18757#35425
    Gitea 1.22.1+attachments/<uuid>, relative to the repository; <img width> / <video> HTML for HiDPI images and videos#18757not covered by #35425 yet, details in #18757

    Gogs, OneDev and SourceHut have no T3 provider, so they're out of scope. The proprietary forges have their own tracks: GitHub Enterprise Server #35443, Bitbucket Cloud #19828 / #28596, Azure DevOps #36148 and GitCafe #30514.

    These PRs each reimplement the same three pieces:

    • resolve a relative link against the right base (origin, repository or project);
    • send the token only to that origin, following redirects by hand without it;
    • take the type from the file name when the forge sends octet-stream.

    A shared fetch helper in source-control-core, plus a definition hook for what a relative link is relative to, would reduce each forge's PR to its URL patterns and credential lookup. #23501's isRepositoryRelativePath is close to that hook. That is a suggestion for maintainers; it shouldn't block #23501.

    Happy to test a rebased #23501 against our private 19.x instance.

  13. Also affects the issue detail panel, not only MR descriptions/comments.

    Environment

    • T3 Code Desktop 0.1.11-nightly.20261118.4864, macOS, Apple Silicon
    • Self-hosted GitLab 18.11.14-ee, private project, glab logged in

    Steps

    1. Open a GitLab issue whose description contains a pasted screenshot (![image](/uploads/<secret>/image.png)).
    2. View it in T3 Code's issue panel.

    Actual: the image doesn't load. The same issue renders fine in T3 Code's built-in browser, where I'm signed in to GitLab.

    Why this is likely the same bug: IssueDetailPanel.tsx renders the body and comments with the same PullRequestMarkdown / PullRequestCommentBody components as the PR panel, so it hits the same /uploads/… resolution path. It would be good if #23501 confirmed (or tested) that the issue panel is covered too, not only MR bodies.

    Checked against this instance (18.11):

    RequestResult
    https://<host>/<group>/<project>/uploads/<secret>/image.png, no auth302 → sign-in
    same URL with PRIVATE-TOKEN: <glab token>302 → sign-in
    glab api projects/<id>/uploads/<secret>/image.png200, valid PNG (1348×964)

    So the upload API approach from #23501 works here; token auth on the web upload URL does not.

  14. Also reproduces on gitlab.com in the iOS app (PR view of a private project's MR), and the symptom differs by where the image sits in the Markdown:

    Empty email on submit:
    
    ![1-empty-email](/uploads/<secret>/1-empty-email.png)
    
    - **Before (1440px):** ![before](/uploads/<secret>/before.png)
      **After (1440px):** ![after](/uploads/<secret>/after.png)
    
    After, dark mode: ![after-dark](/uploads/<secret>/after-dark.png)
    • An image in its own paragraph shows the "Image unavailable" placeholder.
    • An image inline after text (in a list item or on the same line as a label) disappears without a trace: no placeholder, no alt text. A reader can't tell that an image was there at all, which is worse than the placeholder for before/after screenshot lists.

    Checked against gitlab.com for the same upload:

    RequestResult
    https://gitlab.com/uploads/<secret>/<file>, no auth302 -> /users/sign_in
    https://gitlab.com/<group>/<project>/uploads/<secret>/<file>, no auth302 -> /users/sign_in
    same project URL with PRIVATE-TOKEN302 -> sign-in
    glab api projects/<id>/uploads/<secret>/<file>200, valid PNG (1440x1000)

    So the upload API approach of #23501 would cover it. Whatever the fix, it would help if an inline image that fails to load falls back to the same placeholder (or at least its alt text) as a block image.

  15. meded90(GitHub profile, opens in a new tab)commented

    Following up on my earlier report: this is still painful in day-to-day use on our self-hosted GitLab. In T3 Code’s issue detail panel, a screenshot in the description shows “Image unavailable,” and the size annotation ({width=364 height=600}) is printed as plain text. I have to open GitLab separately just to see the screenshot and understand the task.

    image

    Could we prioritize the fix and make sure it covers issue descriptions and comments, not just merge requests? #23501 already proposes a fix for private MR uploads. I also opened Orca PR #21202 for the same issue/MR workflow in another client, using the existing glab login to fetch the images.

Sign in to join this conversation.