You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2019/04/30 10:01:16 UTC
[tika] branch master updated: TIKA-2840 -- make .bat "magic"
detection case-insensitive
This is an automated email from the ASF dual-hosted git repository.
tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git
The following commit(s) were added to refs/heads/master by this push:
new 1ab34b6 TIKA-2840 -- make .bat "magic" detection case-insensitive
new 6745e8d Merge remote-tracking branch 'origin/master'
1ab34b6 is described below
commit 1ab34b647463e0a6a4a12d9939bf01bcc71af352
Author: TALLISON <ta...@apache.org>
AuthorDate: Tue Apr 30 05:59:54 2019 -0400
TIKA-2840 -- make .bat "magic" detection case-insensitive
---
.../resources/org/apache/tika/mime/tika-mimetypes.xml | 5 ++---
.../test/java/org/apache/tika/mime/TestMimeTypes.java | 1 +
.../test/resources/test-documents/testBATUpper.bat | 19 +++++++++++++++++++
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
index bd1adfa..2848ce6 100644
--- a/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
+++ b/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml
@@ -82,9 +82,8 @@
<alias type="application/bat"/>
<sub-class-of type="text/plain"/>
<magic priority="50">
- <match value="@echo off" type="string" offset="0" />
- <match value="rem " type="string" offset="0" />
- <match value="REM " type="string" offset="0" />
+ <match value="@echo off" type="stringignorecase" offset="0" />
+ <match value="rem " type="stringignorecase" offset="0" />
</magic>
<glob pattern="*.bat"/>
<glob pattern="*.cmd"/>
diff --git a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
index a527d4e..bdf7da1 100644
--- a/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
+++ b/tika-parsers/src/test/java/org/apache/tika/mime/TestMimeTypes.java
@@ -628,6 +628,7 @@ public class TestMimeTypes {
assertTypeByName("application/x-bat", "testBAT.bat");
assertTypeByName("application/x-bat", "testCMD.cmd");
assertType( "application/x-bat", "testBAT.bat");
+ assertType( "application/x-bat", "testBATUpper.bat");
}
@Test
diff --git a/tika-parsers/src/test/resources/test-documents/testBATUpper.bat b/tika-parsers/src/test/resources/test-documents/testBATUpper.bat
new file mode 100644
index 0000000..64d74db
--- /dev/null
+++ b/tika-parsers/src/test/resources/test-documents/testBATUpper.bat
@@ -0,0 +1,19 @@
+@ECHO off
+
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+rem Prints the Tika Version
+java -jar tika-app.jar --version