Skip to content

fix: handle non-zipped artifact downloads#13013

Open
dsanders11 wants to merge 2 commits intocli:trunkfrom
dsanders11:fix-non-zipped-artifact-download
Open

fix: handle non-zipped artifact downloads#13013
dsanders11 wants to merge 2 commits intocli:trunkfrom
dsanders11:fix-non-zipped-artifact-download

Conversation

@dsanders11
Copy link

Fixes #13012.

@dsanders11 dsanders11 requested a review from a team as a code owner March 24, 2026 04:06
@github-actions github-actions bot added unmet-requirements external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels Mar 24, 2026
@github-actions
Copy link

Thanks for your pull request! Unfortunately, it doesn't meet the minimum requirements for review:

  • None of the referenced issues have the help wanted label

Please update your PR to address the above. Requirements:

  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123 if it resolves the issue)

This PR will be automatically closed in 7 days if these requirements are not met.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates gh run download to support downloading GitHub Actions artifacts that are not delivered as zip archives (e.g., uploaded with archive: false), avoiding the current unconditional unzip behavior that fails on non-zip payloads.

Changes:

  • Extend the download platform interface to pass artifact name into the download implementation.
  • Add a non-zip download path in the HTTP downloader based on the response Content-Type.
  • Add test coverage and a fixture for non-zipped artifact downloads.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/cmd/run/download/http.go Adds non-zip handling and updates downloader signature to accept artifact name
pkg/cmd/run/download/http_test.go Updates zip test to set Content-Type and adds a non-zip download test
pkg/cmd/run/download/fixtures/mytest.json Adds a fixture representing non-zipped artifact content
pkg/cmd/run/download/download.go Updates platform interface usage to pass artifact name to Download
pkg/cmd/run/download/download_test.go Updates fake platform to match the new Download signature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +48 to +49
if resp.Header.Get("Content-Type") != "application/zip" {
destPath, err := destDir.Join(name)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zip-vs-nonzip decision is based on a strict Content-Type == "application/zip" check. In practice servers often include parameters (e.g. application/zip; charset=binary), omit the header, or use application/octet-stream for zip content, which would route zip downloads into the raw-file path. Parse the media type (e.g. via mime.ParseMediaType) and/or fall back to detecting/attempting zip extraction (and on zip: not a valid zip file, retry as a raw download).

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering these are GitHub controlled servers, I think it's reasonable to just use the Content-Type header to make the distinction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team needs-triage needs to be reviewed unmet-requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't Download Non-Zipped Artifacts

2 participants