Skip to content

Commit 766f1e2

Browse files
committed
Change ZipInputStream to use its own IsEntryCompressionMethodSupported function rather than the one in ZipEntry.
1 parent f03a2ef commit 766f1e2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/ICSharpCode.SharpZipLib/Zip/ZipInputStream.cs

+13-2
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,21 @@ public bool CanDecompressEntry
131131
{
132132
get
133133
{
134-
return (entry != null) && entry.CanDecompress;
134+
return (entry != null) && IsEntryCompressionMethodSupported(entry) && entry.CanDecompress;
135135
}
136136
}
137137

138+
/// <summary>
139+
/// Is the compression method for the specified entry supported?
140+
/// </summary>
141+
/// <param name="entry"></param>
142+
/// <returns></returns>
143+
private static bool IsEntryCompressionMethodSupported(ZipEntry entry)
144+
{
145+
return entry.CompressionMethod == CompressionMethod.Deflated ||
146+
entry.CompressionMethod == CompressionMethod.Stored;
147+
}
148+
138149
/// <summary>
139150
/// Advances to the next entry in the archive
140151
/// </summary>
@@ -271,7 +282,7 @@ public ZipEntry GetNextEntry()
271282
}
272283

273284
// Determine how to handle reading of data if this is attempted.
274-
if (entry.IsCompressionMethodSupported())
285+
if (IsEntryCompressionMethodSupported(entry))
275286
{
276287
internalReader = new ReadDataHandler(InitialRead);
277288
}

0 commit comments

Comments
 (0)