This is an automated email from the ASF dual-hosted git repository.

tballison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/main by this push:
     new 1274775de3 TIKA-4985: detect animated cursors by content (#3386)
1274775de3 is described below

commit 1274775de3ad152e9c60921345d2b6e2083b1ef4
Author: Tim Allison <[email protected]>
AuthorDate: Wed Oct 21 20:05:21 2026 -0400

    TIKA-4985: detect animated cursors by content (#3386)
---
 CHANGES.txt                                                 |  2 ++
 .../main/resources/org/apache/tika/mime/tika-mimetypes.xml  | 10 ++++++++++
 .../test/java/org/apache/tika/mime/MimeDetectionTest.java   | 13 +++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/CHANGES.txt b/CHANGES.txt
index 3a7244534e..85b6897645 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -86,6 +86,8 @@ Release 4.2.0 - unreleased
 
    * New ICOParser for icons and cursors; image/vnd.microsoft.icon moves to it 
from
      ImageParser. Tighter OS/2 bitmap array and TGA detection (TIKA-4937).
+     Animated cursors (RIFF ACON) are application/x-navi-animation, even when 
named
+     *.cur (TIKA-4985).
 
    * BigTIFF is read through metadata-extractor 2.22.0: EXIF and DNG tags are 
extracted from
      BigTIFF DNGs, which previously yielded only XMP and previews, and a plain 
BigTIFF file no
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 8530bdeab2..dda5383b43 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
@@ -4931,6 +4931,16 @@
     <!-- MISAM Data files are header-less, so no magic -->
     <sub-class-of type="application/x-mysql-db"/>
   </mime-type>
+  <mime-type type="application/x-navi-animation">
+    <acronym>ANI</acronym>
+    <_comment>Windows Animated Cursor</_comment>
+    <tika:link>https://en.wikipedia.org/wiki/ANI_(file_format)</tika:link>
+    <magic priority="50">
+      <match value="RIFF....ACON" type="string" offset="0"
+             mask="0xFFFFFFFF00000000FFFFFFFF"/>
+    </magic>
+    <glob pattern="*.ani"/>
+  </mime-type>
   <mime-type type="application/x-nesrom">
     <_comment>Nintendo Entertainment System ROM</_comment>
     <glob pattern="*.nes"/>
diff --git 
a/tika-core/src/test/java/org/apache/tika/mime/MimeDetectionTest.java 
b/tika-core/src/test/java/org/apache/tika/mime/MimeDetectionTest.java
index 8c29f1c609..7dd0178127 100644
--- a/tika-core/src/test/java/org/apache/tika/mime/MimeDetectionTest.java
+++ b/tika-core/src/test/java/org/apache/tika/mime/MimeDetectionTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.tika.mime;
 
+import static java.nio.charset.StandardCharsets.US_ASCII;
 import static java.nio.charset.StandardCharsets.UTF_16BE;
 import static java.nio.charset.StandardCharsets.UTF_16LE;
 import static java.nio.charset.StandardCharsets.UTF_8;
@@ -191,6 +192,18 @@ public class MimeDetectionTest {
         
assertDetected(MediaType.parse("application/vnd.lotus-1-2-3;version=1"), lotus);
     }
 
+    @Test
+    public void testAnimatedCursorDetection() throws Exception {
+        MediaType ani = MediaType.application("x-navi-animation");
+        byte[] acon = new byte[64];
+        System.arraycopy("RIFF".getBytes(US_ASCII), 0, acon, 0, 4);
+        acon[4] = 56;
+        System.arraycopy("ACONanih".getBytes(US_ASCII), 0, acon, 8, 8);
+        assertDetected(ani, acon);
+        // the content beats a *.cur name
+        assertEquals(ani, detect(acon, "pointer.cur"));
+    }
+
     private static byte[] tgaHeader(int idLength, int colourMapType, int 
imageType,
                                     int colourMapEntrySize, int pixelDepth) {
         byte[] header = new byte[64];

Reply via email to