diff --git a/plugins/mapper-attachments/build.gradle b/plugins/mapper-attachments/build.gradle index 94c1778304b..cb98f9e3429 100644 --- a/plugins/mapper-attachments/build.gradle +++ b/plugins/mapper-attachments/build.gradle @@ -55,4 +55,5 @@ compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes' forbiddenPatterns { exclude '**/*.docx' exclude '**/*.pdf' + exclude '**/*.epub' } diff --git a/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/TikaImpl.java b/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/TikaImpl.java index 2575d39335f..38e292725a5 100644 --- a/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/TikaImpl.java +++ b/plugins/mapper-attachments/src/main/java/org/elasticsearch/mapper/attachments/TikaImpl.java @@ -67,6 +67,7 @@ final class TikaImpl { new org.apache.tika.parser.odf.OpenDocumentParser(), new org.apache.tika.parser.iwork.IWorkPackageParser(), new org.apache.tika.parser.xml.DcXMLParser(), + new org.apache.tika.parser.epub.EpubParser(), }; /** autodetector based on this subset */ diff --git a/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/VariousDocTests.java b/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/VariousDocTests.java index 754244464d0..88c15c10c54 100644 --- a/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/VariousDocTests.java +++ b/plugins/mapper-attachments/src/test/java/org/elasticsearch/mapper/attachments/VariousDocTests.java @@ -96,6 +96,14 @@ public class VariousDocTests extends AttachmentUnitTestCase { assertParseable("text-in-english.txt"); testMapper("text-in-english.txt", false); } + + /** + * Test for .epub + */ + public void testEpubDocument() throws Exception { + assertParseable("testEPUB.epub"); + testMapper("testEPUB.epub", false); + } /** * Test for ASCIIDOC diff --git a/plugins/mapper-attachments/src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/testEPUB.epub b/plugins/mapper-attachments/src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/testEPUB.epub new file mode 100644 index 00000000000..a6fc2e634d5 Binary files /dev/null and b/plugins/mapper-attachments/src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/testEPUB.epub differ diff --git a/test-framework/build.gradle b/test-framework/build.gradle index a1d96a77f6f..96d450f877f 100644 --- a/test-framework/build.gradle +++ b/test-framework/build.gradle @@ -33,7 +33,10 @@ dependencies { compile('org.hamcrest:hamcrest-all:1.3') { exclude group: 'org.hamcrest', module: 'hamcrest-core' } - compile "org.apache.httpcomponents:httpclient:${versions.httpclient}" + compile("org.apache.httpcomponents:httpclient:${versions.httpclient}") { + exclude group: 'commons-codec', module: 'commons-codec' + } + compile "commons-codec:commons-codec:1.9" } compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked'