c# - Possible bug in ZipArchive with archive mode update? -
i ran problem ziparchivemode.update
if zip file contains "directory entries".
i know there no such thing directory entry tools produce entries ziparchiveentry.length = 0
, ziparchiveentry.name = ""
directories in zip file.
the following code corrupts zip file:
using (ziparchive archive = zipfile.open(@"d:\temp\test.zip", ziparchivemode.update)) { }
as can see nothing @ except opening zip file ziparchivemode.update
, dispose in end.
the problem "directory entries" seem treated file entries. in output there new 0 byte entries directory names.
i still can open zip file , extract files per drag&drop. attempts extract zip file result in error messages. maybe because there 2 entries same fullname?
my workaround avoid ziparchivemode.update
, use temporary memorystream
. iterate on entries, ignore "directory entries" , copy file entries stream. way worked.
is bug in ziparchive
or entries directories wrong? if want store empty directories in zip? , said: many tools out there seem produce such directory entries.
Comments
Post a Comment