diff --git a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs index 345fdd877d..a253addc93 100644 --- a/src/Tgstation.Server.Host/IO/DefaultIOManager.cs +++ b/src/Tgstation.Server.Host/IO/DefaultIOManager.cs @@ -292,7 +292,15 @@ namespace Tgstation.Server.Host.IO if (zipFile == null) throw new ArgumentNullException(nameof(zipFile)); - using var archive = new ZipArchive(zipFile, ZipArchiveMode.Read); +#if NET7_0_OR_GREATER +#warning Check if zip file seeking has been addressesed. See https://github.com/tgstation/tgstation-server/issues/1531 +#endif + + // ZipArchive does a synchronous copy on unseekable streams we want to avoid + if (!zipFile.CanSeek) + throw new ArgumentException("Stream does not support seeking!", nameof(zipFile)); + + using var archive = new ZipArchive(zipFile, ZipArchiveMode.Read, true); archive.ExtractToDirectory(path); }, cancellationToken, diff --git a/src/Tgstation.Server.Host/IO/IIOManager.cs b/src/Tgstation.Server.Host/IO/IIOManager.cs index 56a5343573..16be142e7d 100644 --- a/src/Tgstation.Server.Host/IO/IIOManager.cs +++ b/src/Tgstation.Server.Host/IO/IIOManager.cs @@ -198,7 +198,7 @@ namespace Tgstation.Server.Host.IO /// Extract a set of to a given . /// /// The path to unzip to. - /// The of the . + /// The of the . Must have set to . Will be read completely and left open. will be indeterminate. /// The for the operation. /// A representing the running operation. Task ZipToDirectory(string path, Stream zipFile, CancellationToken cancellationToken);