Skip to content

Fails to extract file which might or might not be malformed #376

@beeb

Description

@beeb

Describe the bug
One file served by the soldeer registry seems to have a weird directory structure, which never was an issue when using zip-extract. But since that crate now is marked as deprecated and recommends to use zip directly, I am no longer able to extract that file (see link below).

The file was probably created with zip v2.1.3 according to the crawler's lockfile, but take this with a grain of salt (I can't be sure the file was created by the crawler).

To Reproduce
Steps to reproduce the behavior:

  1. Download https://soldeer-revisions.s3.amazonaws.com/forge-std/1_9_2_06-08-2024_17:31:25_forge-std-1.9.2.zip
  2. Try to unzip:
let file = File::open(path).unwrap();
let mut zip = zip::ZipArchive::new(file).unwrap();
zip.extract(dir).unwrap();
  1. Observe the error: InvalidArchive("Invalid file path")

Expected behavior
The file should extract successfully, just like zip-extract, 7-zip and the unzip CLI managed to do. Maybe their implementation are more robust against weird paths?

Screenshots
7-zip shows a _ folder at the root
Image

7-zip properties
Image

Windows Explorer shows an empty folder
Image

Desktop (please complete the following information):

  • OS: Ubuntu (WSL2)

Additional context

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