actions / actions/toolkit

tc.extractZip() failure due to tc.downloadTool() not adding .zip extension

Open
#1,179 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
If no destination is provided when calling tc.downloadTool(), this function defaults to <tempDir>/<uuidv4>. This creates a destination file that doesn't have any file extension, which can apparently cause a subsequent call to tc.extractZip() to fail, with an error like the following:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'C:\actions-runner\_work\_temp\0f5cb3c0-ca78-43d2-9bf3-19b379b1f416' -DestinationPath 'C:\actions-runner\_work\_temp\882ce538-f7ae-45ef-adc9-32c2ee3cd5e1' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\actions-runner\_work\_temp\0f5cb3c0-ca78-43d2-9bf3-19b379b1f416', 'C:\actions-runner\_work\_temp\882ce538-f7ae-45ef-adc9-32c2ee3cd5e1', $true) }"
Expand-Archive : is not a supported archive file format. .zip is the only supported archive file format.

Expected behavior
After downloading a proper zip-file with tc.downloadTool(), tc.extractZip() should run without any errors.

Either:

  • tc.downloadTool() should default to a destination file that has the same file extension as provided in the given url
  • tc.extractZip() should add a .zip extension if necessary
  • Both of the above

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the tc.downloadTool() and tc.extractZip() entry points and trace how their temporary destinations are chosen and passed to archive extraction. Reproduce the Windows failure with a ZIP URL and verify that downloading and extracting a ZIP without an explicit destination completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.