diff --git a/data/custom.xml b/data/custom.xml
index 1df40ef..767b538 100644
--- a/data/custom.xml
+++ b/data/custom.xml
@@ -243,4 +243,20 @@
+
+
+
+
+
+
+
+
diff --git a/data/tika.xml b/data/tika.xml
index 85ab267..81caa38 100644
--- a/data/tika.xml
+++ b/data/tika.xml
@@ -1,5 +1,5 @@
-
+
+
+
+
+
+
+
@@ -841,6 +856,16 @@
+
+
+
+
@@ -879,6 +904,15 @@
+
+
+
+
+
+
@@ -886,34 +920,28 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+ mask="0xFFFFFFFFFFFFFFFFFFFF00FF" offset="2:6"/>
-
-
+
+
+
+
+
@@ -4853,6 +4881,20 @@
+
+
+
+
+
+
+
+
diff --git a/lib/marcel/tables.rb b/lib/marcel/tables.rb
index 2743303..dd69e2c 100644
--- a/lib/marcel/tables.rb
+++ b/lib/marcel/tables.rb
@@ -2799,6 +2799,8 @@ module Marcel
['image/svg+xml', [[0, b['\n".freeze
TIKA_PREAMBLE = /\A(?:<\?xml[^\n]*\?>\n)?/.freeze
diff --git a/script/generate_tables.rb b/script/generate_tables.rb
index 2186289..9770787 100755
--- a/script/generate_tables.rb
+++ b/script/generate_tables.rb
@@ -180,11 +180,11 @@ def self.namespace_uri(value, source)
end
class UnsupportedRules
- # Tika currently contains 59 unsupported XML rules: 58 magic matches plus one root-XML
- # rule. Their pretty-printed warnings span 113 physical lines, so pin the canonical rule
+ # Tika currently contains 60 unsupported XML rules: 59 magic matches plus one root-XML
+ # rule. Their pretty-printed warnings span 114 physical lines, so pin the canonical rule
# set rather than stderr layout.
- EXPECTED_COUNT = 59
- EXPECTED_SHA256 = "f42a5b9b0462e1c467e068b114c33706f28394d52da76111ae3271cdc5e606ce"
+ EXPECTED_COUNT = 60
+ EXPECTED_SHA256 = "61d54e5e5b543d3d3721e4d056e43e2f928fb08b36e94c8b1da88a416a18bb48"
def initialize
@signatures = []
diff --git a/test/fixtures/magic/application/timestamped-data/definite.tsd b/test/fixtures/magic/application/timestamped-data/definite.tsd
new file mode 100644
index 0000000..c0a270e
--- /dev/null
+++ b/test/fixtures/magic/application/timestamped-data/definite.tsd
@@ -0,0 +1 @@
+0‚A*†H†÷
‚0‚,timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped bytes. timestamped byt
\ No newline at end of file
diff --git a/test/fixtures/magic/application/timestamped-data/indefinite.tsd b/test/fixtures/magic/application/timestamped-data/indefinite.tsd
new file mode 100644
index 0000000..26e4922
Binary files /dev/null and b/test/fixtures/magic/application/timestamped-data/indefinite.tsd differ
diff --git a/test/fixtures/magic/application/vnd.android.axml/axml.xml b/test/fixtures/magic/application/vnd.android.axml/axml.xml
new file mode 100644
index 0000000..d98b115
Binary files /dev/null and b/test/fixtures/magic/application/vnd.android.axml/axml.xml differ
diff --git a/test/generate_tables_test.rb b/test/generate_tables_test.rb
index 88a7a03..202a3e3 100644
--- a/test/generate_tables_test.rb
+++ b/test/generate_tables_test.rb
@@ -238,8 +238,8 @@ class Marcel::GenerateTablesTest < Marcel::TestCase
assert status.success?, errors
warning_lines = errors.lines
- assert_equal "Skipped 59 unsupported magic rules\n", warning_lines.pop
- assert_equal 113, warning_lines.size
+ assert_equal "Skipped 60 unsupported magic rules\n", warning_lines.pop
+ assert_equal 114, warning_lines.size
assert File.exist?(tables_path)
end
end
diff --git a/test/magic_test.rb b/test/magic_test.rb
index 8eb4f2e..7babe00 100644
--- a/test/magic_test.rb
+++ b/test/magic_test.rb
@@ -37,6 +37,17 @@ def read(*)
end
end
+ # Before Tika 4.0.0, the timestamped-data magic matched any 11-byte OID under the
+ # 1.2.840.113549 arc, so sibling CMS content types (compressedData, authData, ...) in
+ # 1.2.840.113549.1.9.16.1.* were misdetected as application/timestamped-data. The 4.0.0
+ # rules (carried in data/custom.xml with explicit match types) require the full
+ # id-ct-timestampedData OID ending in .31.
+ test "other CMS content types are not misdetected as timestamped-data" do
+ compressed_data = "\x30\x80\x06\x0B\x2A\x86\x48\x86\xF7\x0D\x01\x09\x10\x01\x09\xA0\x80".b
+
+ assert_equal "application/octet-stream", Marcel::MimeType.for(compressed_data)
+ end
+
test "add and remove type" do
Marcel::Magic.add('application/x-my-thing', extensions: 'mtg', parents: 'application/json')
Marcel::Magic.remove('application/x-my-thing')