-
Notifications
You must be signed in to change notification settings - Fork 509
Closed
Description
ZipReader -> ignored DirectoryEntry completely | Could not extract the zip using ZipReader
sharpcompress/src/SharpCompress/Readers/Zip/ZipReader.cs
Lines 63 to 85 in 095c871
| protected override IEnumerable<ZipEntry> GetEntries(Stream stream) | |
| { | |
| foreach (var h in _headerFactory.ReadStreamHeader(stream)) | |
| { | |
| if (h != null) | |
| { | |
| switch (h.ZipHeaderType) | |
| { | |
| case ZipHeaderType.LocalEntry: | |
| { | |
| yield return new ZipEntry( | |
| new StreamingZipFilePart((LocalEntryHeader)h, stream) | |
| ); | |
| } | |
| break; | |
| case ZipHeaderType.DirectoryEnd: | |
| { | |
| yield break; | |
| } | |
| } | |
| } | |
| } | |
| } |
ZipArchive -> processed DirectoryEntry | Could extract the zip using ZipArchive
sharpcompress/src/SharpCompress/Archives/Zip/ZipArchive.cs
Lines 261 to 296 in 095c871
| switch (h.ZipHeaderType) | |
| { | |
| case ZipHeaderType.DirectoryEntry: | |
| { | |
| var deh = (DirectoryEntryHeader)h; | |
| Stream s; | |
| if ( | |
| deh.RelativeOffsetOfEntryHeader + deh.CompressedSize | |
| > vols[deh.DiskNumberStart].Stream.Length | |
| ) | |
| { | |
| var v = vols.Skip(deh.DiskNumberStart).ToArray(); | |
| s = new SourceStream( | |
| v[0].Stream, | |
| i => i < v.Length ? v[i].Stream : null, | |
| new ReaderOptions() { LeaveStreamOpen = true } | |
| ); | |
| } | |
| else | |
| { | |
| s = vols[deh.DiskNumberStart].Stream; | |
| } | |
| yield return new ZipArchiveEntry( | |
| this, | |
| new SeekableZipFilePart(headerFactory.NotNull(), deh, s) | |
| ); | |
| } | |
| break; | |
| case ZipHeaderType.DirectoryEnd: | |
| { | |
| var bytes = ((DirectoryEndHeader)h).Comment ?? Array.Empty<byte>(); | |
| vols.Last().Comment = ReaderOptions.ArchiveEncoding.Decode(bytes); | |
| yield break; | |
| } | |
| } |
Reactions are currently unavailable