Closed TheOnAndOnlyZenomat closed 6 months ago
I am pretty sure that append(true)
is the wrong thing to do here: all writes to the file will happen at the end of the file, which is probably not what zip
expects.
Can you try opening the file without this option ?
Also you have to clear buf
between two files.
Hey, thank you. append(true)
was indeed the culprit, sorry I didn't notice that myself.
Hello, I am trying to append to an already existing archive with files. Browsing the docs and the repo I found
new_append()
and according to the PR #215 it should update the central directory header and make the new files available next to the already existing files in the archive.Above is my test program. It should append the files from
./asdf/
to./archive.zip
. Executing it the first time works and doesn't crash. But when inspecting the archive with7z l ./archive.zip
I get a warningWARNINGS: There are data after the end of archive
and the new files don't appear in the file listing. Running the above test program again it crashes withInvalidArchive("Invalid Central Directory header")
onnew_append(existing_zip).unwrap()
.Am I using this API wrong, did I miss it's intented usage or is this a genuine bug. If the latter is the case, I'd be very happy to try and fix it (maybe with some guidance) or provide you with testcasts/do profiling and testing.