Skip to content

--attach should accept every file type GitHub supports for attachments (audio, documents, archives) #15025

Open

Agent suggestions

Public preview

Description

@thedavidweng

Describe the feature or problem you’d like to solve

--attach (on gh issue create/edit/comment and gh pr create/edit/comment) only accepts images and videos. Every other file type that GitHub accepts as an attachment in the browser is refused locally, before any request is made:

$ gh version
gh version 2.103.0 (2026-10-21)

$ gh pr comment 100 --body "Rendered mix" --attach mix.mp3
mix.mp3 is not a supported file type (supported: png, jpg, jpeg, gif, webp, svg, mp4, mov, webm)

The Attaching files docs list many more types that can be attached to issue, pull request, and discussion comments, with their own size limit (25MB for "all other files"):

Category Extensions
Documents .pdf, .docx, .pptx, .xlsx, .xls, .xlsm, .odt, .fodt, .ods, .fods, .odp, .fodp, .odg, .fodg, .odf, .rtf, .doc
Text and data .txt, .md, .copilotmd, .csv, .tsv, .log, .json, .jsonc
Development and code .c, .cs, .cpp, .css, .drawio, .dmp, .html, .htm, .java, .js, .ipynb, .patch, .php, .cpuprofile, .pdb, .py, .sh, .sql, .ts, .tsx, .xml, .yaml, .yml
Archives .zip, .gz, .tgz
Communication and logs .debug, .msg, .eml
Images .bmp, .tif, .tiff
Audio .mp3, .wav

Common cases this blocks from the command line: attaching a log or crash dump to a bug report, a .patch or .zip reproduction, a PDF spec, or an audio file for review.

The extension allowlist was introduced in #14178, which limits it to "six image extensions and three video extensions" because those are the two kinds gh knows how to render. Audio and documents don't appear to have been considered either way.

Proposed solution

Accept every extension the docs list, with a third rendering kind next to image and video:

  • Image (embed, ![alt](url)): unchanged. .bmp, .tif, and .tiff are listed under "Additional file types" rather than "Image and media files", so they may belong with links rather than embeds; the web uploader's output for them would settle it.
  • Video (bare URL, rendered as a player): unchanged.
  • File (link, [filename](url)): everything else, matching what the web uploader inserts for a non-media file. --attach path=alt could either be refused (as it is for videos today) or used as the link text.
  • Size limits: images 10MB, videos 100MB (server enforces the 10MB free-plan limit), other files 25MB.
  • Help text for the six commands and the "not a supported file type" error list the new types.

Server-side blocker. Relaxing the allowlist in gh is not enough on its own. I posted sample files directly to the endpoint gh uses (POST https://uploads.github.com/user-attachments/assets?name=...&content_type=...&repository_id=...) with an OAuth token that has write access to the repository. A .png as image/png returned an asset URL, but every non-image, non-video type I tried was refused with HTTP 422:

{
  "message": "Validation Failed",
  "errors": [
    {"resource": "UserAsset", "field": "content_type", "message": "content_type is not included in the list of allowed content types"},
    {"resource": "UserAsset", "field": "name", "message": "name has a file extension that does not match the content type: .mp3 != audio/mpeg"}
  ]
}

I saw the same response for .mp3 (audio/mpeg, audio/mp3, application/octet-stream), .wav (audio/wav), .pdf (application/pdf, application/octet-stream), .zip (application/zip), .gz and .tgz (application/gzip), .txt and .log (text/plain), .csv (text/csv), .json (application/json), .md (text/markdown), .bmp (image/bmp), .tif and .tiff (image/tiff), .py (text/x-python), .sh (application/x-sh), .patch (text/x-diff), .yaml (application/yaml), .xml (application/xml), and .html (text/html).

So this needs the endpoint to accept the same content types as the browser uploader (or documentation of the content type it expects for each extension) before gh can support them. Once it does, the gh side is the allowlist, the link rendering kind, and the size limit above.

Additional context

This issue was drafted with help from an AI agent. The commands and endpoint responses above were run and observed directly.

Activity

  1. cli-triage commented on Nov 11, 2026

    @cli-triage

    GitHub CLI 2.103.3 still limits --attach to six image extensions and three video extensions. The released client has no file attachment kind, 25 MB file limit, or downloadable-link rendering for documents, archives, audio, text, or code files. This request clearly describes that remaining gap across issue and pull request commands. The reported server-side rejection is also an important dependency: expanding the local allowlist alone would not make these uploads work until the upload endpoint accepts the documented file types and content types.

    Supporting reports

    Generated by issue triage.

  2. added
    attachments
    core
    enhancement
    platform
    on Nov 16, 2026
  3. babakks commented on Nov 16, 2026

    @babakks
    Member

    Thanks for the suggestion and investigation, @thedavidweng! 🙏

    As you noted, relaxing the CLI’s file type restrictions alone is not enough: the upload API also rejects these formats. We need support in the API before we can add this functionality to gh.

    I’ll keep this as an enhancement a request to improve CLI and add blocked and platform Problems with the GitHub platform rather than the CLI client to make that dependency clear. Once the API supports these file types, we can revisit support in the CLI.

  4. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  5. removed
    needs-triage
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    attachmentsblockedcoreenhancementplatform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions