Skip to content

Conversation

@tiegz
Copy link

@tiegz tiegz commented Mar 12, 2025

Fixes #971

  • internal/archive_extract.go

    • adds detectFileType() to detect archive file type (using mime sniffing)
    • adds processZipFile() to extract a .zip file
  • internal/archive_extract_test.go

    • adds createZipFile helper to create a zip file fixture
    • adds doZipExtractionTest helper to run zip assertions
    • adds TestExtractSimpleZipFile test
    • adds TestExtractAbsolutePathZipFile test

Notes:

  • I'm on a Mac so I'm unable to do an end-to-end test
  • PyPI and NPM are the only package managers with extractArchive set, but AFAICT NPM only serves tarballs, so PyPI is the only package manager that would use this

if outputDir == "" {
return fmt.Errorf("outputDir is empty")
}

Copy link
Author

Choose a reason for hiding this comment

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

moved this out of extractTar() so it runs earlier

Signed-off-by: Tieg Zaharia <tieg.zaharia@gmail.com>
@tiegz tiegz force-pushed the tz/add-zip-archive-support branch from 95eed6b to 39a8354 Compare March 12, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support extracting zip archives

1 participant