File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
src/ICSharpCode.SharpZipLib/Zip Expand file tree Collapse file tree 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)
26182618 switch ( entry . CompressionMethod )
26192619 {
26202620 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+ }
26222627 break ;
26232628
26242629 case CompressionMethod . Deflated :
26252630 var dos = new DeflaterOutputStream ( result , new Deflater ( 9 , true ) )
26262631 {
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
26282635 } ;
26292636 result = dos ;
26302637 break ;
You can’t perform that action at this time.
0 commit comments