Closed Lancelotbronner closed 8 months ago
I'm aware I'm supposed to handle the case where more than one chunks are sent. Currently I'm trying with small files which fit into a single chunk.
I would also expect to receive valid UTF-8 (if not for maybe the last few bytes) even if chunks are missing, so I'm guessing something happened to those entries.
I've tried with archives using a single top-level directory and that didn't change anything.
I've also noticed that every run seems to corrupt different files, so that makes me inclined to think the issue lies in the reading or decompressing.
let archive = Archive(url: url, accessMode: .read) let entry = archive["example.json"] var data: Data! _ = try database.extract(entry, skipCRC32: true) {
In this snippet you are retrieving an entry from archive
, but then calling extract
on a different Archive
instance called database
. This doesn't seem right.
Ah, I was renaming things on Github for the example because the names were specific to my project.
I am using the same archive, also tried in a small project separately and got the same result.
Why are you setting skipCRC32: true
? What happens when you drop that parameter (which equals skipCRC32: false
)? Are the checksums correct?
Yes they are (I've checked it with true and the same happens), the archive isn't downloaded from the internet it's local.
I also tested with zipping tools and they don't seem to have any issues.
I've also tried with Apple's compression library and it doesn't have any issues, though it doesn't allow extracting files individually.
Can you share your code and the archive?
Summary
I zipped via finder a JSON database (selected a bunch of folders and
right-click > Compress
). I then extract those when needed, most of the files are just fine but some of them come back as garbage.Some files are also just missing seemingly random pieces of text.
Steps to Reproduce
right-click > Compress
)nil
as it fails to recognize UTF-8Expected Results
Actual Results
Regression & Version
ZipFoundation v0.9.17 macOS Sonoma 14.3 Beta (23D5033f) Xcode 15.1 targeting macOS
Related Link