synopse / mORMot

Synopse mORMot 1 ORM/SOA/MVC framework - Please upgrade to mORMot 2 !
https://synopse.info
789 stars 325 forks source link

PasZip.pas wrongly decompress a .zip as empty files #352

Closed PaoloSalvan closed 3 years ago

PaoloSalvan commented 4 years ago

I'm using Delphi 7 and with the following function the attached zip is decompressed as two 0-bytes files (all other zip decompressors correctly decompress them as two non-empty files):

function UnzipFile(sSrcPathName: string; sDestPath: string): boolean; var zip: TZipRead; iCont: integer; begin result:= false;

zip:= TZipRead.Create(sSrcPathName, 0, 0, {ShowMessageBoxOnError=} true);
try
    for iCont:= 0 to zip.Count-1 do
        if not zip.UnZipFile(iCont, sDestPath, {ForceWriteFlush=} true) then
            exit;
finally
    zip.Free;
end;

result:= true;

end;

Test.zip