Fix test failures for multi-threading support in file-based Zips

- Fix build errors in Tar tests by adding !NETFRAMEWORK condition to #if LINUX
- Fix split archive test failures by checking ss.Files.Count == 1 before opening independent file streams
- The multi-threading feature now correctly only applies to single-file ZIP archives, not split/multi-volume archives

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-27 13:18:18 +00:00
parent 5776f7c1ff
commit c11277fbef
3 changed files with 8 additions and 10 deletions

View File

@@ -32,19 +32,17 @@ internal class SeekableZipFilePart : ZipFilePart
protected override Stream CreateBaseStream()
{
if (BaseStream is SourceStream ss)
if (BaseStream is SourceStream ss && ss.IsFileMode && ss.Files.Count == 1)
{
if (ss.IsFileMode)
{
var fileStream = ss.CurrentFile.OpenRead();
fileStream.Position = Header.DataStartPosition.NotNull();
return fileStream;
}
var fileStream = ss.CurrentFile.OpenRead();
fileStream.Position = Header.DataStartPosition.NotNull();
return fileStream;
}
BaseStream.Position = Header.DataStartPosition.NotNull();
return BaseStream;
}
public override bool SupportsMultiThreading => BaseStream is SourceStream ss && ss.IsFileMode;
public override bool SupportsMultiThreading =>
BaseStream is SourceStream ss && ss.IsFileMode && ss.Files.Count == 1;
}

View File

@@ -207,7 +207,7 @@ public class TarReaderAsyncTests : ReaderTests
Assert.Throws<IncompleteArchiveException>(() => reader.MoveToNextEntry());
}
#if LINUX
#if LINUX && !NETFRAMEWORK
[Fact]
public async Task Tar_GZip_With_Symlink_Entries_Async()
{

View File

@@ -201,7 +201,7 @@ public class TarReaderTests : ReaderTests
Assert.Throws<IncompleteArchiveException>(() => reader.MoveToNextEntry());
}
#if LINUX
#if LINUX && !NETFRAMEWORK
[Fact]
public void Tar_GZip_With_Symlink_Entries()
{