Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I try to iterate over the entries of the attached file, nothing happens #318

Open
JetForMe opened this issue Apr 26, 2024 · 1 comment · May be fixed by #319
Open

When I try to iterate over the entries of the attached file, nothing happens #318

JetForMe opened this issue Apr 26, 2024 · 1 comment · May be fixed by #319

Comments

@JetForMe
Copy link

Summary

The attached .3mf file is a zip archive with this directory structure:

GO-M8010-6-P1 copy
├── 3D
│   └── 3dmodel.model
├── [Content_Types].xml
└── _rels

I'm able to partially inspect this

let archive = Archive(ur: url, accessMode: .read)
print(archive.totalNumberOfEntriesInCentralDirectory)         // prints "3"

But I can’t enumerate those top level items:

for entry in archive {
    print("Entry: \(entry)")
}

Prints nothing. Attempting to get archive["3D"] returns nil.

Version
0.9.19

I had to zip the file to get Github to accept it. Unzip it, then try to load the resulting file using Arhive().

GO-M8010-6-P1.3mf.zip

@weichsel
Copy link
Owner

weichsel commented Apr 28, 2024

I can reproduce the issue with the archive you provided.
Currently, I don't have the capacity to investigate/fix this. So far, I found that the archive is using the ZIP64 extensions (which ZIPFoundation supports). But for some reason, it's obtaining wrong offsets from the ZIP64 structure that describes the entries. Due to the wrong offsets, creating an iterator for the entries fails.

Since extraction with the macOS built-in archive utility succeeds and also unzip -t doesn't report any errors, I suppose the archive metadata contains some edge cases that currently aren't not covered by ZIP Foundation's ZIP64 support.

If you want to have a look yourself, a good starting point would be Archive.makeIterator & CentralDirectoryStructure.effectiveRelativeOffsetOfLocalHeader.

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 a pull request may close this issue.

2 participants