Fixed bad extension computing wigh SVG file without xml header line.
This commit is contained in:
parent
6b227a9d12
commit
abf0aebedf
1 changed files with 7 additions and 0 deletions
|
@ -116,6 +116,13 @@ public class StatoolInfosUtils
|
||||||
String mimeTypeLabel = tika.detect(file);
|
String mimeTypeLabel = tika.detect(file);
|
||||||
MimeType mimeType = MimeTypes.getDefaultMimeTypes().forName(mimeTypeLabel);
|
MimeType mimeType = MimeTypes.getDefaultMimeTypes().forName(mimeTypeLabel);
|
||||||
result = mimeType.getExtension();
|
result = mimeType.getExtension();
|
||||||
|
|
||||||
|
// Because Tika failed to recognize SVG file without xml header
|
||||||
|
// line.
|
||||||
|
if (result.equals(".txt") && (StringUtils.startsWithIgnoreCase(FileUtils.readFileToString(file, "UTF8"), "<svg")))
|
||||||
|
{
|
||||||
|
result = ".svg";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException | MimeTypeException exception)
|
catch (IOException | MimeTypeException exception)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue