tballison commented on code in PR #3377:
URL: https://github.com/apache/tika/pull/3377#discussion_r4337014026
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/test/java/org/apache/tika/parser/pkg/RarParserTest.java:
##########
@@ -92,6 +99,25 @@ public void testEmbedded() throws Exception {
assertContains("test-documents/testXML.xml", content);
}
+ @Test
+ public void testCorruptEntryKeepsLaterEntries(@TempDir Path tmp) throws
Exception {
+ byte[] rar;
+ try (TikaInputStream tis =
getResourceAsStream("/test-documents/test-documents.rar")) {
+ rar = IOUtils.toByteArray(tis);
+ }
+ // testEXCEL.xls, the first entry, has its packed data at 80..2885
+ rar[1500] ^= 0x5A;
+ Path corrupt = tmp.resolve("corrupt.rar");
+ Files.write(corrupt, rar);
+
+ List<Metadata> metadataList = getRecursiveMetadata(corrupt, new
ParseContext(), false);
+
assertNotNull(metadataList.get(0).get(TikaCoreProperties.TIKA_META_EXCEPTION_EMBEDDED_STREAM));
+ assertContains("test-documents/testXML.xml",
+ metadataList.get(0).get(TikaCoreProperties.TIKA_CONTENT));
+ assertEquals("/testXML.xml",
+ metadataList.get(metadataList.size() -
1).get(TikaCoreProperties.EMBEDDED_RESOURCE_PATH));
Review Comment:
Yep. Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]