summary refs log tree commit diff
path: root/crypto/src/util/io/compression/Zip.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/util/io/compression/Zip.cs')
-rw-r--r--crypto/src/util/io/compression/Zip.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/src/util/io/compression/Zip.cs b/crypto/src/util/io/compression/Zip.cs
index f2773d63b..e5907c60d 100644
--- a/crypto/src/util/io/compression/Zip.cs
+++ b/crypto/src/util/io/compression/Zip.cs
@@ -21,12 +21,14 @@ namespace Org.BouncyCastle.Utilities.IO.Compression
 #endif
         }
 
-        internal static Stream DecompressInput(Stream stream)
+        internal static Stream DecompressInput(Stream stream, bool leaveOpen = false)
         {
 #if NET6_0_OR_GREATER
-            return new DeflateStream(stream, CompressionMode.Decompress, leaveOpen: false);
+            return new DeflateStream(stream, CompressionMode.Decompress, leaveOpen);
 #else
-            return new ZInputStream(stream, true);
+            return leaveOpen
+                ? new ZInputStreamLeaveOpen(stream, true)
+                : new ZInputStream(stream, true);
 #endif
         }
     }