tika-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1210296 - in /tika/trunk: tika-core/src/main/resources/org/apache/tika/mime/ tika-parsers/src/test/java/org/apache/tika/mime/ tika-parsers/src/test/java/org/apache/tika/parser/microsoft/ tika-parsers/src/test/resources/test-documents/
Date Mon, 05 Dec 2011 00:32:54 GMT
Author: nick
Date: Mon Dec  5 00:32:53 2011
New Revision: 1210296

URL: http://svn.apache.org/viewvc?rev=1210296&view=rev
Log:
TIKA-798 - EMF and WMF metafiles aren't the same, so split the mimetypes, plus add magic+tests
for them (patch from Antoni)

Added:
    tika/trunk/tika-parsers/src/test/resources/test-documents/testEMF.emf   (with props)
    tika/trunk/tika-parsers/src/test/resources/test-documents/testWMF.wmf   (with props)
Modified:
    tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
    tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
    tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/AbstractPOIContainerExtractionTest.java

Modified: tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml?rev=1210296&r1=1210295&r2=1210296&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml (original)
+++ tika/trunk/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml Mon Dec
 5 00:32:53 2011
@@ -2365,6 +2365,15 @@
     <glob pattern="*.elc"/>
   </mime-type>
 
+  <mime-type type="application/x-emf">
+    <acronym>EMF</acronym>
+    <_comment>Extended Metafile</_comment>
+    <glob pattern="*.emf"/>
+    <magic priority="50">
+      <match value="0x01000000" type="string" offset="0"/>
+    </magic>
+  </mime-type>
+
   <mime-type type="application/x-font-bdf">
     <glob pattern="*.bdf"/>
   </mime-type>
@@ -2593,12 +2602,14 @@
     <glob pattern="*.m14"/>
   </mime-type>
   <mime-type type="application/x-msmetafile">
-    <alias type="image/x-emf"/>
     <alias type="image/x-wmf"/>
     <acronym>WMF</acronym>
     <_comment>Windows Metafile</_comment>
     <glob pattern="*.wmf"/>
-    <glob pattern="*.emf"/>
+    <magic priority="50">
+      <match value="0xd7cdc69a0000" type="string" offset="0"/>
+      <match value="0x010009000003" type="string" offset="0"/>
+    </magic>
   </mime-type>
   <mime-type type="application/x-msmoney">
     <glob pattern="*.mny"/>

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java?rev=1210296&r1=1210295&r2=1210296&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java (original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java Mon Dec
 5 00:32:53 2011
@@ -328,16 +328,17 @@ public class TestMimeTypes extends TestC
    }
 
     public void testWmfDetection() throws Exception {
-        // TODO: Need a test wmf file
         assertTypeByName("application/x-msmetafile", "x.wmf");
+        assertTypeByData("application/x-msmetafile", "testWMF.wmf");
         assertTypeByName("application/x-msmetafile", "x.WMF");
-        // TODO: Need a test emf file
-        assertTypeByName("application/x-msmetafile", "x.emf");
-        assertTypeByName("application/x-msmetafile", "x.EMF");
+
+        assertTypeByName("application/x-emf", "x.emf");
+        assertTypeByData("application/x-emf","testEMF.emf");
+        assertTypeByName("application/x-emf", "x.EMF");
         // TODO: Need a test wmz file
         assertTypeByName("application/x-ms-wmz", "x.wmz");
         assertTypeByName("application/x-ms-wmz", "x.WMZ");
-        // TODO: Need a test emf file
+        // TODO: Need a test emz file
         assertTypeByName("application/x-gzip", "x.emz");
         assertTypeByName("application/x-gzip", "x.EMZ");
     }

Modified: tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/AbstractPOIContainerExtractionTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/AbstractPOIContainerExtractionTest.java?rev=1210296&r1=1210295&r2=1210296&view=diff
==============================================================================
--- tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/AbstractPOIContainerExtractionTest.java
(original)
+++ tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/microsoft/AbstractPOIContainerExtractionTest.java
Mon Dec  5 00:32:53 2011
@@ -47,7 +47,8 @@ public abstract class AbstractPOIContain
     public static final MediaType TYPE_JPG = MediaType.image("jpeg");
     public static final MediaType TYPE_GIF = MediaType.image("gif");
     public static final MediaType TYPE_PNG = MediaType.image("png");
-    public static final MediaType TYPE_EMF = MediaType.application("x-msmetafile");
+    public static final MediaType TYPE_EMF = MediaType.application("x-emf");
+    public static final MediaType TYPE_WMF = MediaType.application("x-msmetafile");
 
     protected TrackingHandler process(String filename, ContainerExtractor extractor, boolean
recurse) throws Exception {
         TikaInputStream stream = getTestFile(filename);

Added: tika/trunk/tika-parsers/src/test/resources/test-documents/testEMF.emf
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/resources/test-documents/testEMF.emf?rev=1210296&view=auto
==============================================================================
Binary file - no diff available.

Propchange: tika/trunk/tika-parsers/src/test/resources/test-documents/testEMF.emf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tika/trunk/tika-parsers/src/test/resources/test-documents/testWMF.wmf
URL: http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/resources/test-documents/testWMF.wmf?rev=1210296&view=auto
==============================================================================
Binary file - no diff available.

Propchange: tika/trunk/tika-parsers/src/test/resources/test-documents/testWMF.wmf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message