Fix empty and directory-only 7z archive finalization

This commit is contained in:
Adam Hathcock
2026-10-12 15:28:49 +01:00
parent e4193af83b
commit 9332fb9c70
3 changed files with 93 additions and 0 deletions

View File

@@ -43,6 +43,8 @@ public partial class SevenZipWriter
private async ValueTask FinalizeArchiveAsync()
{
// Reserve the signature even when no file data was written.
await EnsurePlaceholderWrittenAsync(CancellationToken.None).ConfigureAwait(false);
var output = OutputStream.NotNull();
// Current position = end of packed data streams

View File

@@ -193,6 +193,8 @@ public partial class SevenZipWriter : AbstractWriter
private void FinalizeArchive()
{
// Directory-only and empty archives never pass through Write().
EnsurePlaceholderWritten();
var output = OutputStream.NotNull();
// Current position = end of packed data streams