Skip to content

Commit

Permalink
TIKA-4223 -- add detection of stl (#1691)
Browse files Browse the repository at this point in the history
* TIKA-4223 -- add detection for binary and text based stl

(cherry picked from commit 9d45b69)
  • Loading branch information
tballison committed Mar 26, 2024
1 parent 9229702 commit de408df
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2072,7 +2072,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"/>

Expand Down Expand Up @@ -7041,7 +7044,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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public void testHttpServerFileExtensions() {
assertEquals("application/vnd.ms-ims", tika.detect("x.ims"));
assertEquals("application/vnd.ms-lrm", tika.detect("x.lrm"));
assertEquals("application/vnd.ms-pki.seccat", tika.detect("x.cat"));
assertEquals("application/vnd.ms-pki.stl", tika.detect("x.stl"));
assertEquals("model/x.stl-binary", tika.detect("x.stl"));
assertEquals("application/vnd.ms-powerpoint", tika.detect("x.ppt"));
assertEquals("application/vnd.ms-powerpoint", tika.detect("x.pps"));
assertEquals("application/vnd.ms-powerpoint", tika.detect("x.pot"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ public void testSRT() throws Exception {
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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.

0 comments on commit de408df

Please sign in to comment.