From abf0aebedfadaaa29c7897f00154824e227e232f Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 1 Mar 2021 02:02:33 +0100 Subject: [PATCH] Fixed bad extension computing wigh SVG file without xml header line. --- src/fr/devinsy/statoolinfos/core/StatoolInfosUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/fr/devinsy/statoolinfos/core/StatoolInfosUtils.java b/src/fr/devinsy/statoolinfos/core/StatoolInfosUtils.java index b6e8e29..c6084c2 100644 --- a/src/fr/devinsy/statoolinfos/core/StatoolInfosUtils.java +++ b/src/fr/devinsy/statoolinfos/core/StatoolInfosUtils.java @@ -116,6 +116,13 @@ public class StatoolInfosUtils String mimeTypeLabel = tika.detect(file); MimeType mimeType = MimeTypes.getDefaultMimeTypes().forName(mimeTypeLabel); result = mimeType.getExtension(); + + // Because Tika failed to recognize SVG file without xml header + // line. + if (result.equals(".txt") && (StringUtils.startsWithIgnoreCase(FileUtils.readFileToString(file, "UTF8"), "