Update src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Adam Hathcock
2026-01-28 08:26:28 +00:00
committed by GitHub
parent 8a67d501a8
commit 484bc740d7

View File

@@ -271,8 +271,15 @@ public class SevenZipArchive : AbstractArchive<SevenZipArchiveEntry, SevenZipVol
return CreateEntryStream(Stream.Null);
}
var folder = entry.FilePart.Folder;
var filePart = (SevenZipFilePart)entry.FilePart;
if (!filePart.Header.HasStream)
{
// Entries with no underlying stream (e.g., empty files or anti-items)
// should return an empty stream, matching previous behavior.
return CreateEntryStream(Stream.Null);
}
var folder = filePart.Folder;
// Check if we're starting a new folder - dispose old folder stream if needed
if (folder != _currentFolder)
{