Skip to content

Commit 6a09233

Browse files
committed
TIKA-1823 AutoCAD DWF mime magic and subtypes
Parent AutoCAD DWF mimetype and general magic, based on patch from Luca Moretti, along with version-specific subtypes with more specific magic
1 parent 38fbc50 commit 6a09233

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml

+30
Original file line numberDiff line numberDiff line change
@@ -5250,8 +5250,38 @@
52505250
</mime-type>
52515251

52525252
<mime-type type="model/vnd.dwf">
5253+
<acronym>DWF</acronym>
5254+
<_comment>AutoCAD Design Web Format</_comment>
5255+
<alias type="drawing/x-dwf"/>
5256+
<magic priority="50">
5257+
<match type="string" offset="0" value="(DWF V">
5258+
<match type="string" offset="8" value=".">
5259+
<match type="string" offset="11" value=")" />
5260+
</match>
5261+
</match>
5262+
</magic>
52535263
<glob pattern="*.dwf"/>
52545264
</mime-type>
5265+
<mime-type type="model/vnd.dwf;version=6">
5266+
<!-- Zip file with DWF header on the front -->
5267+
<magic priority="60">
5268+
<match type="string" offset="0" value="(DWF V06.">
5269+
<match type="string" offset="11" value=")PK" />
5270+
</match>
5271+
</magic>
5272+
<sub-class-of type="model/vnd.dwf"/>
5273+
</mime-type>
5274+
<mime-type type="model/vnd.dwf;version=5">
5275+
<magic priority="60">
5276+
<match type="string" offset="0" value="(DWF V00.55)"/>
5277+
</magic>
5278+
</mime-type>
5279+
<mime-type type="model/vnd.dwf;version=2">
5280+
<magic priority="60">
5281+
<match type="string" offset="0" value="(DWF V00.22)"/>
5282+
</magic>
5283+
</mime-type>
5284+
52555285
<mime-type type="model/vnd.dwfx+xps">
52565286
<_comment>AutoCAD Design Web Format</_comment>
52575287
<glob pattern="*.dwfx"/>

tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java

+5
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,11 @@ public void testAutoCADDetection() throws Exception {
537537
assertTypeByData("image/vnd.dwg", "testDWG2007.dwg");
538538
assertTypeByData("image/vnd.dwg", "testDWG2010.dwg");
539539

540+
// From name, gets the common parent type
541+
assertTypeByName("model/vnd.dwf", "x.dwf");
542+
// With the data, can work out it's the v6 zip-based flavour
543+
assertTypeByData("model/vnd.dwf; version=6", "testDWF2010.dwf");
544+
540545
// From name, gets the common parent type
541546
assertTypeByName("image/vnd.dxf", "x.dxf");
542547
// With the data, can work out it's the ASCII flavour

0 commit comments

Comments
 (0)