try to fix issue with invalid files after commons-compress upgrade

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915895 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2024-02-20 16:31:04 +00:00
parent fded4957db
commit 3817f138f8
1 changed files with 3 additions and 1 deletions

View File

@ -155,7 +155,9 @@ public class ZipArchiveThresholdInputStream extends FilterInputStream {
}
return entry;
} catch (ZipException ze) {
if (ze.getMessage().startsWith("Unexpected record signature")) {
final String msg = ze.getMessage();
if (msg.startsWith("Unexpected record signature")
|| msg.startsWith("Cannot find zip signature within the file")) {
throw new NotOfficeXmlFileException(
"No valid entries or contents found, this is not a valid OOXML (Office Open XML) file", ze);
}