[
https://issues.apache.org/jira/browse/TIKA-1692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14635687#comment-14635687
]
Tim Allison commented on TIKA-1692:
-----------------------------------
Nothing like unit tests... So, all is well for straight mime strings for texty
files; however, if there is an encoding attached (as we currently receive in
the Metadata from an auto-detected document), we run into the problem that
initially inspired this issue.
{{noformat}}
@Test
public void testCurrent() throws Exception {
MimeTypes types = config.getMimeRepository();
assertEquals("application/xml", MediaType.APPLICATION_XML.toString());
MimeType mimeType = types.forName(MediaType.APPLICATION_XML.toString());
assertEquals(".xml", mimeType.getExtension());
MimeType mime = types.forName("application/xml; charset=UTF-8");
assertEquals("", mime.getExtension());
}
{{noformat}}
> Enable getExtension() for texty file types
> ------------------------------------------
>
> Key: TIKA-1692
> URL: https://issues.apache.org/jira/browse/TIKA-1692
> Project: Tika
> Issue Type: Improvement
> Components: core
> Reporter: Tim Allison
> Priority: Trivial
> Fix For: 1.10
>
> Attachments: MimeUtilTest.java
>
>
> {{getExtension()}} offers a handy way to add a "detected" extension from a
> {{MimeType}} for a file that didn't come with an extension. However, this
> functionality doesn't work with texty files: html, xml, css, csv, etc.
> Let's add a static helper class (or build it into {{MimeType}}?) that will
> output an extension for all mime types including texty mime types.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)