mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 17:25:03 +02:00
fixed GH #2188: handle directory entries stored with DEFLATE compression method
This commit is contained in:
parent
20f9320f2d
commit
27dc684d77
@ -300,7 +300,7 @@ inline bool ZipFileInfo::isFile() const
|
||||
inline bool ZipFileInfo::isDirectory() const
|
||||
{
|
||||
poco_assert_dbg(!_fileName.empty());
|
||||
return getUncompressedSize() == 0 && getCompressionMethod() == ZipCommon::CM_STORE && _fileName[_fileName.length()-1] == '/';
|
||||
return getUncompressedSize() == 0 && _fileName[_fileName.length()-1] == '/';
|
||||
}
|
||||
|
||||
|
||||
|
@ -464,7 +464,7 @@ inline bool ZipLocalFileHeader::isFile() const
|
||||
inline bool ZipLocalFileHeader::isDirectory() const
|
||||
{
|
||||
poco_assert_dbg(!_fileName.empty());
|
||||
return getUncompressedSize() == 0 && getCompressionMethod() == ZipCommon::CM_STORE && _fileName[_fileName.length()-1] == '/';
|
||||
return getUncompressedSize() == 0 && _fileName[_fileName.length()-1] == '/';
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,6 +86,13 @@ bool Decompress::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeade
|
||||
Poco::File aFile(dir);
|
||||
aFile.createDirectories();
|
||||
}
|
||||
if (hdr.getCompressionMethod() == ZipCommon::CM_DEFLATE)
|
||||
{
|
||||
// If directory is stored with deflate method, two extra bytes
|
||||
// (the result of deflating a zero-length sequence) must be read.
|
||||
char buffer[2];
|
||||
zipStream.read(buffer, 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
try
|
||||
|
Loading…
x
Reference in New Issue
Block a user