Skip to content

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

@rsenden

Description

@rsenden

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions