File tree 1 file changed +9
-2
lines changed
src/ICSharpCode.SharpZipLib/Zip
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2618,13 +2618,20 @@ private Stream GetOutputStream(ZipEntry entry)
2618
2618
switch ( entry . CompressionMethod )
2619
2619
{
2620
2620
case CompressionMethod . Stored :
2621
- result = new UncompressedStream ( result ) ;
2621
+ if ( ! entry . IsCrypted )
2622
+ {
2623
+ // If there is an encryption stream in use, that can be returned directly
2624
+ // otherwise, wrap the base stream in an UncompressedStream instead of returning it directly
2625
+ result = new UncompressedStream ( result ) ;
2626
+ }
2622
2627
break ;
2623
2628
2624
2629
case CompressionMethod . Deflated :
2625
2630
var dos = new DeflaterOutputStream ( result , new Deflater ( 9 , true ) )
2626
2631
{
2627
- IsStreamOwner = false
2632
+ // If there is an encryption stream in use, then we want that to be disposed when the deflator stream is disposed
2633
+ // If not, then we don't want it to dispose the base stream
2634
+ IsStreamOwner = entry . IsCrypted
2628
2635
} ;
2629
2636
result = dos ;
2630
2637
break ;
You can’t perform that action at this time.
0 commit comments