Repository navigation
Description
Code of Proposed Design
Resolving mime types of Release assets is done here.
Proposed Design
Currently, uploaded asset mime types are only resolved by the extensions of the assets. It would be valuable to have a consistent gh release create experience whether releasing tarballs or cross-platform binaries built by a Rust or Zig toolchain by uploading the artifacts with specific and detailed mime types for the uploaded artifacts.
This proposed change would be adding a check with the file command on darwin/linux systems. First an extension-based mime type would be quickly resolved without forking a process. If the mime type is unresolved and the process is on appropriate systems, fork a file -b --mime-type "$_filename" process to get an accurate mime type.
The current workaround to achieve accurate mime types for application binaries is gh release create without asset uploads and then upload all assets in a bash loop with curl and file commands. This proposed design would enhance gh release create to correctly resolve application/x-pie-executable and application/x-mach-binary and allow a great simplification in CICD release pipelines.
Mockup
Here is a primitive impl that executes file on darwin/linux and uses that if detected:
func typeForFilename(fn string, fp string) string {
ext := fileExt(fn)
switch ext {
case ".zip":
return "application/zip"
case ".js":
return "application/javascript"
case ".tar":
return "application/x-tar"
case ".tgz", ".tar.gz":
return "application/x-gtar"
case ".bz2":
return "application/x-bzip2"
case ".dmg":
return "application/x-apple-diskimage"
case ".rpm":
return "application/x-rpm"
case ".deb":
return "application/x-debian-package"
}
if t := mime.TypeByExtension(ext); t != "" {
return t
}
if runtime.GOOS != "windows" {
out, err := exec.Command("file", "-b", "--mime-type", "--", fp).Output()
if err == nil {
if ct := strings.TrimSpace(string(out)); detected != "" {
return ct
}
}
}
return "application/octet-stream"
}See #15089 for a demonstration implemtation.
Activity
cli-triage commentedon Nov 17, 2026
Thanks for the detailed proposal. I checked GitHub CLI 2.104.0, where release asset uploads still choose the
Content-Typefrom the filename extension and useapplication/octet-streamwhen no extension mapping exists. The release commands do not currently offer a flag to override that value. This means extensionless Rust or Zig binaries cannot receive the more specific executable media types throughgh release createorgh release uploadalone. The requested content-based fallback is therefore a current feature gap, while the existing extension-based behavior would remain the fast path.Supporting reports
Duplicate analysis
Label reasoning
Investigation notes
Generated by issue triage.
github-actions commentedon Nov 17, 2026
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 wantedContributions 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.