Since LibreOffice 24.8.2, they have changed the validation of their zip files.
When we use minizip-ng to recreate an LibreOffice document by using mz_zip_writer_copy_from_reader() or manually via mz_zip_writer_entry_write()
Opening the document in LibreOffice, we get "The file "example.odg" is corrupt and therefore cannot be opened. LibreOffice can try to repair the file." (When the document is "repaired", the file opens as expected)
The LibreOffice function is in core/package/source/zippackage/ZipPackage.cxx "void ZipPackage::checkZipEntriesWithDD()". This throws an exception: "entry STORED with data descriptor"
To fix this: After opening the zip file (mz_zip_writer_open_file), set an internal minizip flag:
Since LibreOffice 24.8.2, they have changed the validation of their zip files.
When we use minizip-ng to recreate an LibreOffice document by using mz_zip_writer_copy_from_reader() or manually via mz_zip_writer_entry_write()
Opening the document in LibreOffice, we get "The file "example.odg" is corrupt and therefore cannot be opened. LibreOffice can try to repair the file." (When the document is "repaired", the file opens as expected)
The LibreOffice function is in core/package/source/zippackage/ZipPackage.cxx "void ZipPackage::checkZipEntriesWithDD()". This throws an exception: "entry STORED with data descriptor"
To fix this: After opening the zip file (mz_zip_writer_open_file), set an internal minizip flag:
This sets the use of data descriptor flag when writing zip entries.
mz_zip_writer_copy_from_reader() / mz_zip_writer_entry_open() now works as expected with LibreOffice files.
I don't know the details of why this is required.
For reference, see my initial LibreOffice bug report. https://bugs.documentfoundation.org/show_bug.cgi?id=163818