You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2024/03/25 21:06:09 UTC

(tika) branch TIKA-4223 created (now b856af369)

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a change to branch TIKA-4223
in repository https://gitbox.apache.org/repos/asf/tika.git


      at b856af369 TIKA-4223 -- add detection for binary and text based stl

This branch includes the following new commits:

     new b856af369 TIKA-4223 -- add detection for binary and text based stl

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(tika) 01/01: TIKA-4223 -- add detection for binary and text based stl

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch TIKA-4223
in repository https://gitbox.apache.org/repos/asf/tika.git

commit b856af369c2674f459a04fa17ab43f2837808d21
Author: tallison <ta...@apache.org>
AuthorDate: Mon Mar 25 17:05:54 2024 -0400

    TIKA-4223 -- add detection for binary and text based stl
---
 .../resources/org/apache/tika/mime/tika-mimetypes.xml  |  17 +++++++++++++++--
 .../test/java/org/apache/tika/mime/TestMimeTypes.java  |   6 ++++++
 .../test/resources/test-documents/testSTL-ascii.stl    |  16 ++++++++++++++++
 .../test/resources/test-documents/testSTL-binary.stl   | Bin 0 -> 160 bytes
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
index 7176332ef..7883462fd 100644
--- a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
+++ b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
@@ -2069,7 +2069,10 @@
     <glob pattern="*.cat"/>
   </mime-type>
   <mime-type type="application/vnd.ms-pki.stl">
-    <glob pattern="*.stl"/>
+    <!-- on TIKA-4223, we moved this glob to model/x.stl-binary.
+    We think this pki.stl is a subtype of pkcs7-signature?!
+    -->
+    <!--<glob pattern="*.stl"/> -->
   </mime-type>
   <mime-type type="application/vnd.ms-playready.initiator+xml"/>
 
@@ -7130,7 +7133,17 @@
     <glob pattern="*.mesh"/>
     <glob pattern="*.silo"/>
   </mime-type>
-
+  <mime-type type="model/x.stl-ascii">
+    <magic priority="60">
+      <match value="solid " offset="0" type="string">
+        <match value="facet " offset="7:256" type="string"/>
+      </match>
+    </magic>
+  </mime-type>
+  <mime-type type="model/x.stl-binary">
+    <_comment>no magic available</_comment>
+    <glob pattern="*.stl"/>
+  </mime-type>
   <mime-type type="model/vnd.dwf">
     <acronym>DWF</acronym>
     <_comment>AutoCAD Design Web Format</_comment>
diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/TestMimeTypes.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/TestMimeTypes.java
index 1b66a7efe..cd6705b69 100644
--- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/TestMimeTypes.java
+++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/java/org/apache/tika/mime/TestMimeTypes.java
@@ -212,6 +212,12 @@ public class TestMimeTypes {
         assertTypeByNameAndData("application/x-subrip", "test_subrip.srt");
     }
 
+    @Test
+    public void testSTL() throws Exception {
+        assertTypeByNameAndData("model/x.stl-binary", "testSTL-binary.stl");
+        assertTypeByNameAndData("model/x.stl-ascii", "testSTL-ascii.stl");
+    }
+
     @Test
     public void testTTML() throws Exception {
         assertTypeByData("application/ttml+xml", "test_ttml.ttml");
diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testSTL-ascii.stl b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testSTL-ascii.stl
new file mode 100644
index 000000000..9d5bfe085
--- /dev/null
+++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testSTL-ascii.stl
@@ -0,0 +1,16 @@
+solid OpenSCAD_Model
+  facet normal 0 0 -1
+    outer loop
+      vertex -10 -35 0
+      vertex 10 -25 0
+      vertex 10 -35 0
+    endloop
+  endfacet
+  facet normal -0 0 -1
+    outer loop
+      vertex 10 -25 0
+      vertex -10 -35 0
+      vertex -10 -25 0
+    endloop
+  endfacet
+endsolid OpenSCAD_Model
diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testSTL-binary.stl b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testSTL-binary.stl
new file mode 100644
index 000000000..e76f48fd1
Binary files /dev/null and b/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testSTL-binary.stl differ