marcel 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -6
- data/SECURITY.md +7 -0
- data/lib/marcel/magic/definitions.rb +39 -0
- data/lib/marcel/magic/xml.rb +488 -0
- data/lib/marcel/magic/zip.rb +201 -0
- data/lib/marcel/magic.rb +204 -26
- data/lib/marcel/mime_type/definitions.rb +31 -40
- data/lib/marcel/mime_type.rb +60 -14
- data/lib/marcel/tables.rb +259 -24
- data/lib/marcel/version.rb +1 -1
- metadata +9 -19
data/lib/marcel/mime_type.rb
CHANGED
|
@@ -3,12 +3,46 @@
|
|
|
3
3
|
module Marcel
|
|
4
4
|
class MimeType
|
|
5
5
|
BINARY = "application/octet-stream"
|
|
6
|
+
MAX_DECLARED_TYPE_BYTES = 8 * 1024
|
|
7
|
+
TOKEN = "[!#$%&'*+\\-.^_`|~0-9A-Za-z]+"
|
|
8
|
+
QUOTED_STRING = '"(?:[\t\x20\x21\x23-\x5B\x5D-\x7E\x80-\xFF]|\\\\[\t\x20-\x7E\x80-\xFF])*"'
|
|
9
|
+
MEDIA_TYPE = %r{\A(#{TOKEN}/#{TOKEN})(?:[ \t]*;[ \t]*#{TOKEN}=(?:#{TOKEN}|#{QUOTED_STRING}))*(?:[ \t]*;[ \t]*)?\z}n
|
|
6
10
|
|
|
7
11
|
class << self
|
|
8
|
-
def
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
def canonicalize(type, instead_of:)
|
|
13
|
+
Magic.canonicalize type, instead_of: instead_of
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def extend(type, extensions: nil, aliases: nil, parents: nil, magic: nil)
|
|
17
|
+
type = type.downcase
|
|
18
|
+
|
|
19
|
+
if canonical = Marcel::TYPE_ALIASES[type]
|
|
20
|
+
warn "#{type} is an alias; extending its canonical type #{canonical} instead"
|
|
21
|
+
type = canonical
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
extensions = Array(extensions)
|
|
25
|
+
if extensions.any? && extensions.sort == Array(Marcel::TYPE_EXTS[type]).sort
|
|
26
|
+
warn "#{type} already has extensions #{extensions.inspect}"
|
|
27
|
+
end
|
|
28
|
+
extensions |= Array(Marcel::TYPE_EXTS[type])
|
|
29
|
+
|
|
30
|
+
aliases = Array(aliases)
|
|
31
|
+
existing_aliases = Marcel::TYPE_ALIASES.select { |_, existing| existing == type }.keys
|
|
32
|
+
if aliases.any? && aliases.sort == existing_aliases.sort
|
|
33
|
+
warn "#{type} already has aliases #{aliases.inspect}"
|
|
34
|
+
end
|
|
35
|
+
aliases |= existing_aliases
|
|
36
|
+
|
|
37
|
+
parents = Array(parents)
|
|
38
|
+
if parents.any? && parents.sort == Array(Marcel::TYPE_PARENTS[type]).sort
|
|
39
|
+
warn "#{type} already has parents #{parents.inspect}"
|
|
40
|
+
end
|
|
41
|
+
parents |= Array(Marcel::TYPE_PARENTS[type])
|
|
42
|
+
|
|
43
|
+
# No duplicate-magic warning: matcher order determines precedence, so re-registering
|
|
44
|
+
# an existing matcher legitimately promotes it ahead of the generated tables.
|
|
45
|
+
Magic.add(type, extensions: extensions, magic: magic, aliases: aliases, parents: parents)
|
|
12
46
|
end
|
|
13
47
|
|
|
14
48
|
# Returns the most appropriate content type for the given file.
|
|
@@ -23,7 +57,13 @@ module Marcel
|
|
|
23
57
|
#
|
|
24
58
|
# The most appropriate type is determined by the following:
|
|
25
59
|
# * type declared by binary magic number data
|
|
26
|
-
# *
|
|
60
|
+
# * valid declared MIME type, unless it is application/octet-stream
|
|
61
|
+
# * type inferred from the file name or extension
|
|
62
|
+
#
|
|
63
|
+
# A later candidate is used only if it is more specific than the type already found.
|
|
64
|
+
#
|
|
65
|
+
# The result is a best-effort label, not validation that the file is safe or conforms to
|
|
66
|
+
# the returned type. Treat +name+ and +declared_type+ as hints from their respective sources.
|
|
27
67
|
#
|
|
28
68
|
# If no type can be determined, then +application/octet-stream+ is returned.
|
|
29
69
|
def for(pathname_or_io = nil, name: nil, extension: nil, declared_type: nil)
|
|
@@ -37,7 +77,8 @@ module Marcel
|
|
|
37
77
|
if pathname_or_io
|
|
38
78
|
with_io(pathname_or_io) do |io|
|
|
39
79
|
if magic = Marcel::Magic.by_magic(io)
|
|
40
|
-
magic.type.downcase
|
|
80
|
+
type = magic.canonical.type.downcase
|
|
81
|
+
Marcel::Magic::Xml.refine(io, Marcel::Magic::Zip.refine(io, type))
|
|
41
82
|
end
|
|
42
83
|
end
|
|
43
84
|
end
|
|
@@ -46,7 +87,7 @@ module Marcel
|
|
|
46
87
|
def for_name(name)
|
|
47
88
|
if name
|
|
48
89
|
if magic = Marcel::Magic.by_path(name)
|
|
49
|
-
magic.type.downcase
|
|
90
|
+
magic.canonical.type.downcase
|
|
50
91
|
end
|
|
51
92
|
end
|
|
52
93
|
end
|
|
@@ -54,13 +95,13 @@ module Marcel
|
|
|
54
95
|
def for_extension(extension)
|
|
55
96
|
if extension
|
|
56
97
|
if magic = Marcel::Magic.by_extension(extension)
|
|
57
|
-
magic.type.downcase
|
|
98
|
+
magic.canonical.type.downcase
|
|
58
99
|
end
|
|
59
100
|
end
|
|
60
101
|
end
|
|
61
102
|
|
|
62
103
|
def for_declared_type(declared_type)
|
|
63
|
-
type = parse_media_type(declared_type)
|
|
104
|
+
type = Marcel::Magic.canonical(parse_media_type(declared_type))
|
|
64
105
|
|
|
65
106
|
# application/octet-stream is treated as an undeclared/missing type,
|
|
66
107
|
# allowing the type to be inferred from the filename. If there's no
|
|
@@ -70,17 +111,22 @@ module Marcel
|
|
|
70
111
|
|
|
71
112
|
def with_io(pathname_or_io, &block)
|
|
72
113
|
if defined?(Pathname) && pathname_or_io.is_a?(Pathname)
|
|
73
|
-
pathname_or_io.open(&block)
|
|
114
|
+
pathname_or_io.open("rb", &block)
|
|
74
115
|
else
|
|
75
116
|
yield pathname_or_io
|
|
76
117
|
end
|
|
77
118
|
end
|
|
78
119
|
|
|
79
120
|
def parse_media_type(content_type)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
121
|
+
return unless content_type
|
|
122
|
+
return if content_type.bytesize > MAX_DECLARED_TYPE_BYTES
|
|
123
|
+
|
|
124
|
+
content_type = content_type.dup.force_encoding(Encoding::BINARY)
|
|
125
|
+
content_type.sub!(/\A[ \t\r\n]+/n, "")
|
|
126
|
+
content_type.sub!(/[ \t\r\n]+\z/n, "")
|
|
127
|
+
|
|
128
|
+
media_type = MEDIA_TYPE.match(content_type)
|
|
129
|
+
media_type[1].downcase.force_encoding(Encoding::UTF_8) if media_type
|
|
84
130
|
end
|
|
85
131
|
|
|
86
132
|
# For some document types (notably Microsoft Office) we recognise the main content
|
data/lib/marcel/tables.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# This file is auto-generated. Instead of editing this file, please
|
|
4
|
-
# add MIMEs to data/custom.xml or lib/marcel
|
|
4
|
+
# add MIMEs to data/custom.xml or the definitions files under lib/marcel.
|
|
5
5
|
|
|
6
6
|
module Marcel
|
|
7
7
|
# @private
|
|
@@ -414,6 +414,7 @@ module Marcel
|
|
|
414
414
|
'grv' => 'application/vnd.groove-injector',
|
|
415
415
|
'grxml' => 'application/srgs+xml',
|
|
416
416
|
'gsf' => 'application/x-font-ghostscript',
|
|
417
|
+
'gsheet' => 'application/vnd.google-apps.spreadsheet',
|
|
417
418
|
'gslib' => 'audio/x-psf',
|
|
418
419
|
'gtar' => 'application/x-gtar',
|
|
419
420
|
'gtm' => 'application/vnd.groove-tool-message',
|
|
@@ -441,7 +442,7 @@ module Marcel
|
|
|
441
442
|
'hpgl' => 'application/vnd.hp-hpgl',
|
|
442
443
|
'hpid' => 'application/vnd.hp-hpid',
|
|
443
444
|
'hpp' => 'text/x-c++hdr',
|
|
444
|
-
'hprof' => 'application/vnd.java.hprof
|
|
445
|
+
'hprof' => 'application/vnd.java.hprof',
|
|
445
446
|
'hprof.txt' => 'application/vnd.java.hprof.text',
|
|
446
447
|
'hps' => 'application/vnd.hp-hps',
|
|
447
448
|
'hqx' => 'application/mac-binhex40',
|
|
@@ -769,7 +770,7 @@ module Marcel
|
|
|
769
770
|
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
|
770
771
|
'ott' => 'application/vnd.oasis.opendocument.text-template',
|
|
771
772
|
'owl' => 'application/rdf+xml',
|
|
772
|
-
'oxps' => 'application/
|
|
773
|
+
'oxps' => 'application/oxps',
|
|
773
774
|
'oxt' => 'application/vnd.openofficeorg.extension',
|
|
774
775
|
'p' => 'text/x-pascal',
|
|
775
776
|
'p10' => 'application/pkcs10',
|
|
@@ -1360,6 +1361,7 @@ module Marcel
|
|
|
1360
1361
|
'application/onenote; format=package' => %w(onepkg), # OneNote Package
|
|
1361
1362
|
'application/onenote;format=one' => %w(one),
|
|
1362
1363
|
'application/onenote;format=onetoc2' => %w(onetoc onetoc2), # OneNote Table of Contents
|
|
1364
|
+
'application/oxps' => %w(oxps), # Open XML Paper Specification (OpenXPS)
|
|
1363
1365
|
'application/patch-ops-error+xml' => %w(xer),
|
|
1364
1366
|
'application/pdf' => %w(pdf), # Portable Document Format
|
|
1365
1367
|
'application/pgp-encrypted' => %w(pgp gpg),
|
|
@@ -1496,6 +1498,7 @@ module Marcel
|
|
|
1496
1498
|
'application/vnd.geogebra.tool' => %w(ggt),
|
|
1497
1499
|
'application/vnd.geometry-explorer' => %w(gex gre),
|
|
1498
1500
|
'application/vnd.gmx' => %w(gmx),
|
|
1501
|
+
'application/vnd.google-apps.spreadsheet' => %w(gsheet), # Google Sheets
|
|
1499
1502
|
'application/vnd.google-earth.kml+xml' => %w(kml), # Keyhole Markup Language
|
|
1500
1503
|
'application/vnd.google-earth.kmz' => %w(kmz),
|
|
1501
1504
|
'application/vnd.grafeq' => %w(gqf gqs),
|
|
@@ -1617,7 +1620,7 @@ module Marcel
|
|
|
1617
1620
|
'application/vnd.ms-word.template.macroenabled.12' => %w(dotm), # Office Open XML Document Template (macro-enabled)
|
|
1618
1621
|
'application/vnd.ms-works' => %w(wps wks wcm wdb),
|
|
1619
1622
|
'application/vnd.ms-wpl' => %w(wpl),
|
|
1620
|
-
'application/vnd.ms-xpsdocument' => %w(xps
|
|
1623
|
+
'application/vnd.ms-xpsdocument' => %w(xps), # Open XML Paper Specification
|
|
1621
1624
|
'application/vnd.msa-disk-image' => %w(msa), # Magic Shadow Archiver
|
|
1622
1625
|
'application/vnd.mseq' => %w(mseq),
|
|
1623
1626
|
'application/vnd.musician' => %w(mus),
|
|
@@ -2238,7 +2241,163 @@ module Marcel
|
|
|
2238
2241
|
'video/x-sgi-movie' => %w(movie),
|
|
2239
2242
|
'x-conference/x-cooltalk' => %w(ice), # Cooltalk Audio
|
|
2240
2243
|
}
|
|
2244
|
+
# @private
|
|
2245
|
+
# :nodoc:
|
|
2246
|
+
TYPE_ALIASES = {
|
|
2247
|
+
'application/acad' => 'image/vnd.dwg',
|
|
2248
|
+
'application/autocad_dwg' => 'image/vnd.dwg',
|
|
2249
|
+
'application/bat' => 'application/x-bat',
|
|
2250
|
+
'application/binhex' => 'application/mac-binhex40',
|
|
2251
|
+
'application/cdr' => 'application/coreldraw',
|
|
2252
|
+
'application/dwg' => 'image/vnd.dwg',
|
|
2253
|
+
'application/font-woff' => 'font/woff',
|
|
2254
|
+
'application/font-woff2' => 'font/woff2',
|
|
2255
|
+
'application/gzip-compressed' => 'application/gzip',
|
|
2256
|
+
'application/gzipped' => 'application/gzip',
|
|
2257
|
+
'application/javascript' => 'text/javascript',
|
|
2258
|
+
'application/mac-binhex' => 'application/mac-binhex40',
|
|
2259
|
+
'application/matlab-mat' => 'application/x-matlab-data',
|
|
2260
|
+
'application/ms-tnef' => 'application/vnd.ms-tnef',
|
|
2261
|
+
'application/msexcel' => 'application/vnd.ms-excel',
|
|
2262
|
+
'application/msonenote' => 'application/onenote',
|
|
2263
|
+
'application/mspowerpoint' => 'application/vnd.ms-powerpoint',
|
|
2264
|
+
'application/pgp' => 'application/pgp-encrypted',
|
|
2265
|
+
'application/photoshop' => 'image/vnd.adobe.photoshop',
|
|
2266
|
+
'application/smil' => 'application/smil+xml',
|
|
2267
|
+
'application/vnd.debian.binary-package' => 'application/x-debian-package',
|
|
2268
|
+
'application/vnd.ms-opentype' => 'application/x-font-otf',
|
|
2269
|
+
'application/vnd.ms-visio' => 'application/vnd.visio',
|
|
2270
|
+
'application/vnd.ms-word' => 'application/msword',
|
|
2271
|
+
'application/vnd.oasis.opendocument.database' => 'application/vnd.oasis.opendocument.base',
|
|
2272
|
+
'application/x-123' => 'application/vnd.lotus-1-2-3',
|
|
2273
|
+
'application/x-acad' => 'image/vnd.dwg',
|
|
2274
|
+
'application/x-arj-compressed' => 'application/x-arj',
|
|
2275
|
+
'application/x-autocad' => 'image/vnd.dwg',
|
|
2276
|
+
'application/x-cdr' => 'application/coreldraw',
|
|
2277
|
+
'application/x-coreldraw' => 'application/coreldraw',
|
|
2278
|
+
'application/x-dbm' => 'application/x-berkeley-db',
|
|
2279
|
+
'application/x-deflate' => 'application/zlib',
|
|
2280
|
+
'application/x-dwg' => 'image/vnd.dwg',
|
|
2281
|
+
'application/x-emf' => 'image/emf',
|
|
2282
|
+
'application/x-frame' => 'application/vnd.mif',
|
|
2283
|
+
'application/x-gnumeric-spreadsheet' => 'application/x-gnumeric',
|
|
2284
|
+
'application/x-gunzip' => 'application/gzip',
|
|
2285
|
+
'application/x-gzip' => 'application/gzip',
|
|
2286
|
+
'application/x-gzip-compressed' => 'application/gzip',
|
|
2287
|
+
'application/x-httpd-jsp' => 'text/x-jsp',
|
|
2288
|
+
'application/x-java' => 'application/java-vm',
|
|
2289
|
+
'application/x-java-vm' => 'application/java-vm',
|
|
2290
|
+
'application/x-javascript' => 'text/javascript',
|
|
2291
|
+
'application/x-kchart' => 'application/vnd.kde.kchart',
|
|
2292
|
+
'application/x-koan' => 'application/vnd.koan',
|
|
2293
|
+
'application/x-kpresenter' => 'application/vnd.kde.kpresenter',
|
|
2294
|
+
'application/x-kspread' => 'application/vnd.kde.kspread',
|
|
2295
|
+
'application/x-kword' => 'application/vnd.kde.kword',
|
|
2296
|
+
'application/x-mif' => 'application/vnd.mif',
|
|
2297
|
+
'application/x-mimearchive' => 'multipart/related',
|
|
2298
|
+
'application/x-ms-emz' => 'image/x-emf-compressed',
|
|
2299
|
+
'application/x-msi' => 'application/x-ms-installer',
|
|
2300
|
+
'application/x-msmetafile' => 'image/wmf',
|
|
2301
|
+
'application/x-ogg' => 'audio/vorbis',
|
|
2302
|
+
'application/x-pdf' => 'application/pdf',
|
|
2303
|
+
'application/x-rar' => 'application/x-rar-compressed',
|
|
2304
|
+
'application/x-setupscript' => 'application/inf',
|
|
2305
|
+
'application/x-speex' => 'audio/speex',
|
|
2306
|
+
'application/x-tcl' => 'text/x-tcl',
|
|
2307
|
+
'application/x-troff' => 'text/troff',
|
|
2308
|
+
'application/x-troff-man' => 'text/troff',
|
|
2309
|
+
'application/x-troff-me' => 'text/troff',
|
|
2310
|
+
'application/x-troff-ms' => 'text/troff',
|
|
2311
|
+
'application/x-unix-archive' => 'application/x-archive',
|
|
2312
|
+
'application/x-vnd.oasis.opendocument.chart' => 'application/vnd.oasis.opendocument.chart',
|
|
2313
|
+
'application/x-vnd.oasis.opendocument.chart-template' => 'application/vnd.oasis.opendocument.chart-template',
|
|
2314
|
+
'application/x-vnd.oasis.opendocument.formula' => 'application/vnd.oasis.opendocument.formula',
|
|
2315
|
+
'application/x-vnd.oasis.opendocument.formula-template' => 'application/vnd.oasis.opendocument.formula-template',
|
|
2316
|
+
'application/x-vnd.oasis.opendocument.graphics' => 'application/vnd.oasis.opendocument.graphics',
|
|
2317
|
+
'application/x-vnd.oasis.opendocument.graphics-template' => 'application/vnd.oasis.opendocument.graphics-template',
|
|
2318
|
+
'application/x-vnd.oasis.opendocument.image' => 'application/vnd.oasis.opendocument.image',
|
|
2319
|
+
'application/x-vnd.oasis.opendocument.image-template' => 'application/vnd.oasis.opendocument.image-template',
|
|
2320
|
+
'application/x-vnd.oasis.opendocument.presentation' => 'application/vnd.oasis.opendocument.presentation',
|
|
2321
|
+
'application/x-vnd.oasis.opendocument.presentation-template' => 'application/vnd.oasis.opendocument.presentation-template',
|
|
2322
|
+
'application/x-vnd.oasis.opendocument.spreadsheet' => 'application/vnd.oasis.opendocument.spreadsheet',
|
|
2323
|
+
'application/x-vnd.oasis.opendocument.spreadsheet-template' => 'application/vnd.oasis.opendocument.spreadsheet-template',
|
|
2324
|
+
'application/x-vnd.oasis.opendocument.text' => 'application/vnd.oasis.opendocument.text',
|
|
2325
|
+
'application/x-vnd.oasis.opendocument.text-master' => 'application/vnd.oasis.opendocument.text-master',
|
|
2326
|
+
'application/x-vnd.oasis.opendocument.text-template' => 'application/vnd.oasis.opendocument.text-template',
|
|
2327
|
+
'application/x-vnd.oasis.opendocument.text-web' => 'application/vnd.oasis.opendocument.text-web',
|
|
2328
|
+
'application/x-vnd.sun.xml.writer' => 'application/vnd.sun.xml.writer',
|
|
2329
|
+
'application/x-windows-installer' => 'application/x-ms-installer',
|
|
2330
|
+
'application/x-wine-extension-inf' => 'application/inf',
|
|
2331
|
+
'application/x-x509-user-cert' => 'application/x-x509-cert',
|
|
2332
|
+
'application/x-xml' => 'application/xml',
|
|
2333
|
+
'application/x-yaml' => 'text/x-yaml',
|
|
2334
|
+
'application/x-yml' => 'text/x-yaml',
|
|
2335
|
+
'application/x-zip-compressed' => 'application/zip',
|
|
2336
|
+
'application/yaml' => 'text/x-yaml',
|
|
2337
|
+
'audio/aac' => 'audio/x-aac',
|
|
2338
|
+
'audio/aiff' => 'audio/x-aiff',
|
|
2339
|
+
'audio/flac' => 'audio/x-flac',
|
|
2340
|
+
'audio/wav' => 'audio/vnd.wave',
|
|
2341
|
+
'audio/wave' => 'audio/vnd.wave',
|
|
2342
|
+
'audio/x-m4a' => 'audio/mp4',
|
|
2343
|
+
'audio/x-mp4a' => 'audio/mp4',
|
|
2344
|
+
'audio/x-mpeg' => 'audio/mpeg',
|
|
2345
|
+
'audio/x-ogg-flac' => 'audio/x-oggflac',
|
|
2346
|
+
'audio/x-ogg-pcm' => 'audio/x-oggpcm',
|
|
2347
|
+
'audio/x-realaudio' => 'audio/x-pn-realaudio',
|
|
2348
|
+
'audio/x-wav' => 'audio/vnd.wave',
|
|
2349
|
+
'drawing/dwg' => 'image/vnd.dwg',
|
|
2350
|
+
'drawing/x-dwf' => 'model/vnd.dwf',
|
|
2351
|
+
'gzip/document' => 'application/gzip',
|
|
2352
|
+
'image/cdr' => 'application/coreldraw',
|
|
2353
|
+
'image/hevc' => 'image/heic',
|
|
2354
|
+
'image/hevc-sequence' => 'image/heic-sequence',
|
|
2355
|
+
'image/ntf' => 'image/nitf',
|
|
2356
|
+
'image/vnd.dgn;ver=8' => 'image/vnd.dgn;version=8',
|
|
2357
|
+
'image/x-bmp' => 'image/bmp',
|
|
2358
|
+
'image/x-cdr' => 'application/coreldraw',
|
|
2359
|
+
'image/x-dcx' => 'image/vnd.zbrush.dcx',
|
|
2360
|
+
'image/x-dwg' => 'image/vnd.dwg',
|
|
2361
|
+
'image/x-emf' => 'image/emf',
|
|
2362
|
+
'image/x-icon' => 'image/vnd.microsoft.icon',
|
|
2363
|
+
'image/x-jb2' => 'image/x-jbig2',
|
|
2364
|
+
'image/x-ms-bmp' => 'image/bmp',
|
|
2365
|
+
'image/x-pc-paintbrush' => 'image/vnd.zbrush.pcx',
|
|
2366
|
+
'image/x-pcx' => 'image/vnd.zbrush.pcx',
|
|
2367
|
+
'image/x-psd' => 'image/vnd.adobe.photoshop',
|
|
2368
|
+
'image/x-targa' => 'image/x-tga',
|
|
2369
|
+
'image/x-wmf' => 'image/wmf',
|
|
2370
|
+
'image/xcf' => 'image/x-xcf',
|
|
2371
|
+
'message/rfc2557' => 'multipart/related',
|
|
2372
|
+
'text/properties' => 'text/x-java-properties',
|
|
2373
|
+
'text/rss' => 'application/rss+xml',
|
|
2374
|
+
'text/rtf' => 'application/rtf',
|
|
2375
|
+
'text/vnd.yaml' => 'text/x-yaml',
|
|
2376
|
+
'text/x-asm' => 'text/x-assembly',
|
|
2377
|
+
'text/x-c' => 'text/x-csrc',
|
|
2378
|
+
'text/x-dtd' => 'application/xml-dtd',
|
|
2379
|
+
'text/x-java' => 'text/x-java-source',
|
|
2380
|
+
'text/x-markdown' => 'text/markdown',
|
|
2381
|
+
'text/x-properties' => 'text/x-java-properties',
|
|
2382
|
+
'text/x-tex' => 'application/x-tex',
|
|
2383
|
+
'text/x-texinfo' => 'application/x-texinfo',
|
|
2384
|
+
'text/x-web-markdown' => 'text/markdown',
|
|
2385
|
+
'text/x-yml' => 'text/x-yaml',
|
|
2386
|
+
'text/xml' => 'application/xml',
|
|
2387
|
+
'text/xml-external-parsed-entity' => 'application/xml-external-parsed-entity',
|
|
2388
|
+
'text/xsl' => 'application/xslt+xml',
|
|
2389
|
+
'text/yaml' => 'text/x-yaml',
|
|
2390
|
+
'video/avi' => 'video/x-msvideo',
|
|
2391
|
+
'video/jpm' => 'image/jpm',
|
|
2392
|
+
'video/msvideo' => 'video/x-msvideo',
|
|
2393
|
+
'video/x-daala' => 'video/daala',
|
|
2394
|
+
'video/x-ogg-rgb' => 'video/x-oggrgb',
|
|
2395
|
+
'video/x-ogg-uvs' => 'video/x-ogguvs',
|
|
2396
|
+
'video/x-ogg-yuv' => 'video/x-oggyuv',
|
|
2397
|
+
'video/x-theora' => 'video/theora',
|
|
2398
|
+
}
|
|
2241
2399
|
TYPE_PARENTS = {
|
|
2400
|
+
'application/atom+xml' => %w(application/xml),
|
|
2242
2401
|
'application/bizagi-modeler' => %w(application/zip),
|
|
2243
2402
|
'application/dash+xml' => %w(application/xml),
|
|
2244
2403
|
'application/dif+xml' => %w(application/xml),
|
|
@@ -2258,8 +2417,10 @@ module Marcel
|
|
|
2258
2417
|
'application/onenote; format=package' => %w(application/vnd.ms-cab-compressed),
|
|
2259
2418
|
'application/onenote;format=one' => %w(application/onenote),
|
|
2260
2419
|
'application/onenote;format=onetoc2' => %w(application/onenote),
|
|
2420
|
+
'application/oxps' => %w(application/x-tika-ooxml),
|
|
2261
2421
|
'application/rdf+xml' => %w(application/xml),
|
|
2262
2422
|
'application/relax-ng-compact-syntax' => %w(text/plain),
|
|
2423
|
+
'application/rss+xml' => %w(application/xml),
|
|
2263
2424
|
'application/rtf' => %w(text/plain),
|
|
2264
2425
|
'application/sldworks' => %w(application/x-tika-msoffice),
|
|
2265
2426
|
'application/smil+xml' => %w(application/xml),
|
|
@@ -2273,6 +2434,7 @@ module Marcel
|
|
|
2273
2434
|
'application/vnd.apple.pages' => %w(application/vnd.apple.iwork),
|
|
2274
2435
|
'application/vnd.etsi.asic-e+zip' => %w(application/zip),
|
|
2275
2436
|
'application/vnd.etsi.asic-s+zip' => %w(application/zip),
|
|
2437
|
+
'application/vnd.google-apps.spreadsheet' => %w(application/json),
|
|
2276
2438
|
'application/vnd.google-earth.kml+xml' => %w(application/xml),
|
|
2277
2439
|
'application/vnd.google-earth.kmz' => %w(application/zip),
|
|
2278
2440
|
'application/vnd.iptc.g2.newsmessage+xml' => %w(application/xml),
|
|
@@ -2388,9 +2550,13 @@ module Marcel
|
|
|
2388
2550
|
'application/x-xliff+xml' => %w(application/xml),
|
|
2389
2551
|
'application/x-xliff+zip' => %w(application/zip),
|
|
2390
2552
|
'application/x-xmind' => %w(application/zip),
|
|
2553
|
+
'application/xhtml+xml' => %w(application/xml),
|
|
2391
2554
|
'application/xml' => %w(text/plain),
|
|
2392
2555
|
'application/xml-dtd' => %w(text/plain),
|
|
2393
2556
|
'application/xquery' => %w(text/plain),
|
|
2557
|
+
'application/xslfo+xml' => %w(application/xml),
|
|
2558
|
+
'application/xslt+xml' => %w(application/xml),
|
|
2559
|
+
'application/xspf+xml' => %w(application/xml),
|
|
2394
2560
|
'audio/mp4' => %w(video/mp4),
|
|
2395
2561
|
'audio/ogg' => %w(application/ogg),
|
|
2396
2562
|
'audio/opus' => %w(audio/ogg),
|
|
@@ -2510,6 +2676,79 @@ module Marcel
|
|
|
2510
2676
|
'video/x-ms-wmv' => %w(video/x-ms-asf),
|
|
2511
2677
|
'video/x-ogm' => %w(video/ogg),
|
|
2512
2678
|
}
|
|
2679
|
+
# @private
|
|
2680
|
+
# :nodoc:
|
|
2681
|
+
ROOT_XML = {
|
|
2682
|
+
[nil, 'ASX'] => 'application/x-ms-asx',
|
|
2683
|
+
[nil, 'BODY'] => 'text/html',
|
|
2684
|
+
[nil, 'DIF'] => 'application/dif+xml',
|
|
2685
|
+
[nil, 'FRAMESET'] => 'text/html',
|
|
2686
|
+
[nil, 'HTML'] => 'text/html',
|
|
2687
|
+
[nil, 'IFRAME'] => 'text/html',
|
|
2688
|
+
[nil, 'LINK'] => 'text/html',
|
|
2689
|
+
[nil, 'MD_metadata'] => 'text/iso19139+xml',
|
|
2690
|
+
[nil, 'ONIXMessage'] => 'application/onix-message+xml',
|
|
2691
|
+
[nil, 'P'] => 'text/html',
|
|
2692
|
+
[nil, 'PremiereData'] => 'image/vnd.adobe.premiere',
|
|
2693
|
+
[nil, 'RDF'] => 'application/rdf+xml',
|
|
2694
|
+
[nil, 'SCRIPT'] => 'text/html',
|
|
2695
|
+
[nil, 'Workbook'] => 'application/vnd.ms-spreadsheetml',
|
|
2696
|
+
[nil, 'amf'] => 'application/x-amf',
|
|
2697
|
+
[nil, 'asx'] => 'application/x-ms-asx',
|
|
2698
|
+
[nil, 'body'] => 'text/html',
|
|
2699
|
+
[nil, 'concept'] => 'application/dita+xml;format=concept',
|
|
2700
|
+
[nil, 'frameset'] => 'text/html',
|
|
2701
|
+
[nil, 'html'] => 'text/html',
|
|
2702
|
+
[nil, 'iframe'] => 'text/html',
|
|
2703
|
+
[nil, 'kml'] => 'application/vnd.google-earth.kml+xml',
|
|
2704
|
+
[nil, 'link'] => 'text/html',
|
|
2705
|
+
[nil, 'map'] => 'application/dita+xml;format=map',
|
|
2706
|
+
[nil, 'newsMessage'] => 'application/vnd.iptc.g2.newsmessage+xml',
|
|
2707
|
+
[nil, 'p'] => 'text/html',
|
|
2708
|
+
[nil, 'plist'] => 'application/x-plist',
|
|
2709
|
+
[nil, 'rss'] => 'application/rss+xml',
|
|
2710
|
+
[nil, 'script'] => 'text/html',
|
|
2711
|
+
[nil, 'smil'] => 'application/smil+xml',
|
|
2712
|
+
[nil, 'stata_dta'] => 'application/x-stata-dta',
|
|
2713
|
+
[nil, 'task'] => 'application/dita+xml;format=task',
|
|
2714
|
+
[nil, 'topic'] => 'application/dita+xml;format=topic',
|
|
2715
|
+
[nil, 'val'] => 'application/dita+xml;format=val',
|
|
2716
|
+
[nil, 'wordDocument'] => 'application/vnd.ms-wordml',
|
|
2717
|
+
['http://developer.apple.com/namespaces/keynote2', 'presentation'] => 'application/vnd.apple.keynote',
|
|
2718
|
+
['http://developer.apple.com/namespaces/ls', 'document'] => 'application/vnd.apple.numbers',
|
|
2719
|
+
['http://developer.apple.com/namespaces/sl', 'document'] => 'application/vnd.apple.pages',
|
|
2720
|
+
['http://docs.oasis-open.org/namespace', 'concept'] => 'application/dita+xml;format=concept',
|
|
2721
|
+
['http://docs.oasis-open.org/namespace', 'map'] => 'application/dita+xml;format=map',
|
|
2722
|
+
['http://docs.oasis-open.org/namespace', 'task'] => 'application/dita+xml;format=task',
|
|
2723
|
+
['http://docs.oasis-open.org/namespace', 'topic'] => 'application/dita+xml;format=topic',
|
|
2724
|
+
['http://docs.oasis-open.org/namespace', 'val'] => 'application/dita+xml;format=val',
|
|
2725
|
+
['http://earth.google.com/kml/2.0', 'kml'] => 'application/vnd.google-earth.kml+xml',
|
|
2726
|
+
['http://earth.google.com/kml/2.1', 'kml'] => 'application/vnd.google-earth.kml+xml',
|
|
2727
|
+
['http://earth.google.com/kml/2.2', 'kml'] => 'application/vnd.google-earth.kml+xml',
|
|
2728
|
+
['http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/', 'DIF'] => 'application/dif+xml',
|
|
2729
|
+
['http://iptc.org/std/nar/2006-10-01/', 'newsMessage'] => 'application/vnd.iptc.g2.newsmessage+xml',
|
|
2730
|
+
['http://ns.adobe.com/xdp/', 'xdp'] => 'application/vnd.adobe.xdp+xml',
|
|
2731
|
+
['http://ns.adobe.com/xfdf/', 'xfdf'] => 'application/vnd.adobe.xfdf',
|
|
2732
|
+
['http://ns.editeur.org/onix/3.0/reference', 'ONIXMessage'] => 'application/onix-message+xml',
|
|
2733
|
+
['http://ns.editeur.org/onix/3.0/short', 'ONIXmessage'] => 'application/onix-message+xml',
|
|
2734
|
+
['http://purl.org/atom/ns#', 'feed'] => 'application/atom+xml',
|
|
2735
|
+
['http://schemas.microsoft.com/office/2006/xmlPackage', 'package'] => 'application/vnd.ms-word2006ml',
|
|
2736
|
+
['http://schemas.microsoft.com/office/word/2003/wordml', 'wordDocument'] => 'application/vnd.ms-wordml',
|
|
2737
|
+
['http://www.gribuser.ru/xml/fictionbook/2.0', 'FictionBook'] => 'application/x-fictionbook+xml',
|
|
2738
|
+
['http://www.isotc211.org/2005/gmd', 'MD_metadata'] => 'text/iso19139+xml',
|
|
2739
|
+
['http://www.opengis.net/kml/2.2', 'kml'] => 'application/vnd.google-earth.kml+xml',
|
|
2740
|
+
['http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDF'] => 'application/rdf+xml',
|
|
2741
|
+
['http://www.w3.org/1999/XSL/Format', 'root'] => 'application/xslfo+xml',
|
|
2742
|
+
['http://www.w3.org/1999/XSL/Transform', 'stylesheet'] => 'application/xslt+xml',
|
|
2743
|
+
['http://www.w3.org/1999/xhtml', 'html'] => 'application/xhtml+xml',
|
|
2744
|
+
['http://www.w3.org/2000/svg', 'svg'] => 'image/svg+xml',
|
|
2745
|
+
['http://www.w3.org/2005/Atom', 'feed'] => 'application/atom+xml',
|
|
2746
|
+
['http://www.w3.org/ns/ttml', 'tt'] => 'application/ttml+xml',
|
|
2747
|
+
['http://xspf.org/ns/0/', 'playlist'] => 'application/xspf+xml',
|
|
2748
|
+
['urn:oasis:names:tc:opendocument:xmlns:office:1.0', 'document'] => 'application/vnd.oasis.opendocument.tika.flat.document',
|
|
2749
|
+
['urn:oasis:names:tc:xliff:document:1.2', 'xliff'] => 'application/x-xliff+xml',
|
|
2750
|
+
['urn:schemas-microsoft-com:office:spreadsheet', 'Workbook'] => 'application/vnd.ms-spreadsheetml',
|
|
2751
|
+
}
|
|
2513
2752
|
b = Hash.new { |h, k| h[k] = k.b.freeze }
|
|
2514
2753
|
# @private
|
|
2515
2754
|
# :nodoc:
|
|
@@ -2517,16 +2756,22 @@ module Marcel
|
|
|
2517
2756
|
['image/jpeg', [[0, b["\377\330\377"]]]],
|
|
2518
2757
|
['image/png', [[0, b["\211PNG\r\n\032\n"]]]],
|
|
2519
2758
|
['image/gif', [[0, b['GIF87a']], [0, b['GIF89a']]]],
|
|
2759
|
+
['image/x-canon-cr2', [[0, b["MM\000*"], [[8, b['CR']]]], [0, b["II*\000"], [[8, b['CR']]]], [0, b["MM\000+"], [[8, b['CR']]]]]],
|
|
2520
2760
|
['image/tiff', [[0, b["MM\000*"]], [0, b["II*\000"]], [0, b["MM\000+"]]]],
|
|
2521
2761
|
['image/bmp', [[0, b['BM'], [[26, b["\001\000"], [[0, nil, [[0, nil, [[28, b["\000\000"]], [28, b["\001\000"]], [28, b["\004\000"]], [28, b["\b\000"]], [28, b["\020\000"]], [28, b["\030\000"]], [28, b[" \000"]]]], [30, b["\000\000\000\000"]]]]]]]]]],
|
|
2522
2762
|
['image/vnd.adobe.photoshop', [[0, b["8BPS\000\001"]], [0, b["8BPS\000\002"]]]],
|
|
2523
2763
|
['image/webp', [[0, b['RIFF'], [[8, b['WEBP']]]]]],
|
|
2524
|
-
['text/html', [[0, /(?i)<(html|head|body|title|div)[ >]/], [0, /(?i)<h[123][ >]/]]],
|
|
2525
2764
|
['image/svg+xml', [[0, b['<svg']]]],
|
|
2526
2765
|
['video/x-msvideo', [[0, b['RIFF'], [[8, b['AVI ']]]], [8, b['AVI ']]]],
|
|
2527
2766
|
['video/x-ms-wmv', [[0..8192, b["W\000i\000n\000d\000o\000w\000s\000 \000M\000e\000d\000i\000a\000 \000V\000i\000d\000e\000o\000"]], [0..8192, b["V\000C\000-\0001\000 \000A\000d\000v\000a\000n\000c\000e\000d\000 \000P\000r\000o\000f\000i\000l\000e\000"]], [0..8192, b["w\000m\000v\0002\000"]]]],
|
|
2528
2767
|
['video/mp4', [[4, b['ftypmp41']], [4, b['ftypmp42']]]],
|
|
2529
2768
|
['audio/mp4', [[4, b['ftypM4A ']], [4, b['ftypM4B ']], [4, b['ftypF4A ']], [4, b['ftypF4B ']]]],
|
|
2769
|
+
['image/heic', [[4, b['ftypheic']], [4, b['ftypheix']]]],
|
|
2770
|
+
['image/heic-sequence', [[4, b['ftyphevc']], [4, b['ftyphevx']]]],
|
|
2771
|
+
['image/heif', [[4, b['ftypmif1']]]],
|
|
2772
|
+
['image/heif-sequence', [[4, b['ftypmsf1']]]],
|
|
2773
|
+
['image/x-canon-cr3', [[4, b['ftypcrx ']]]],
|
|
2774
|
+
['video/x-m4v', [[4, b['ftypM4V ']], [4, b['ftypM4VH']], [4, b['ftypM4VP']]]],
|
|
2530
2775
|
['video/quicktime', [[4, b["moov\000"]], [4, b["mdat\000"]], [4, b["free\000"]], [4, b["skip\000"]], [4, b["pnot\000"]], [4, b['ftyp']], [0, b["\000\000\000\bwide"]]]],
|
|
2531
2776
|
['video/mpeg', [[0, b["\000\000\001\263"]], [0, b["\000\000\001\272"]]]],
|
|
2532
2777
|
['video/webm', [[0, b["\032E\337\243"], [[4..4096, b["B\202"], [[4..4096, b['webm'], [[4..4096, b['V_VP8']], [4..4096, b['V_VP9']], [4..4096, b['V_AV1']]]]]]]]]],
|
|
@@ -2534,16 +2779,17 @@ module Marcel
|
|
|
2534
2779
|
['video/x-flv', [[0, b['FLV']]]],
|
|
2535
2780
|
['audio/mpeg', [[0, b["\377\362"]], [0, b["\377\363"]], [0, b["\377\364"]], [0, b["\377\365"]], [0, b["\377\366"]], [0, b["\377\367"]], [0, b["\377\372"]], [0, b["\377\373"]], [0, b["\377\374"]], [0, b["\377\375"]], [0, b["\377\343"]], [0, b['ID3']]]],
|
|
2536
2781
|
['application/pdf', [[0, b['%PDF-']], [0, b["\357\273\277%PDF-"]]]],
|
|
2537
|
-
['application/msword', [[0..8, b["\320\317\021\340\241\261\032\341"], [[
|
|
2782
|
+
['application/msword', [[2080, b['Microsoft Word 6.0 Document']], [2080, b['Documento Microsoft Word 6']], [2112, b['MSWordDoc']], [0, b["1\276\000\000"]], [0, b['PO^Q`']], [0, b["\3767\000#"]], [0, b["\333\245-\000\000\000"]], [0, b["\224\246."]], [0..8, b["\320\317\021\340\241\261\032\341"], [[1152..4096, b["W\000o\000r\000d\000D\000o\000c\000u\000m\000e\000n\000t"]]]]]],
|
|
2538
2783
|
['application/vnd.openxmlformats-officedocument.wordprocessingml.document', [[0, b["PK\003\004"], [[30..65536, b['[Content_Types].xml'], [[0..4096, b['word/']]]], [30, b['_rels/.rels'], [[0..4096, b['word/']]]]]]]],
|
|
2539
2784
|
['application/vnd.ms-powerpoint', [[0..8, b["\320\317\021\340\241\261\032\341"], [[1152..4096, b["P\000o\000w\000e\000r\000P\000o\000i\000n\000t\000 D\000o\000c\000u\000m\000e\000n\000t"]]]]]],
|
|
2540
2785
|
['application/vnd.openxmlformats-officedocument.presentationml.presentation', [[0, b["PK\003\004"], [[30..65536, b['[Content_Types].xml'], [[0..4096, b['ppt/']]]], [30, b['_rels/.rels'], [[0..4096, b['ppt/']]]]]]]],
|
|
2786
|
+
['application/x-tika-msworks-spreadsheet', [[0..8, b["\320\317\021\340\241\261\032\341"], [[1152..4096, b["W\000k\000s\000S\000S\000W\000o\000r\000k\000B\000o\000o\000k"]]]]]],
|
|
2541
2787
|
['application/vnd.ms-excel', [[2080, b['Microsoft Excel 5.0 Worksheet']], [2080, b['Foglio di lavoro Microsoft Exce']], [2114, b['Biff5']], [2121, b['Biff5']], [0..8, b["\320\317\021\340\241\261\032\341"], [[1152..4096, b["W\000o\000r\000k\000b\000o\000o\000k"]]]]]],
|
|
2542
2788
|
['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', [[0, b["PK\003\004"], [[30..65536, b['[Content_Types].xml'], [[0..4096, b['xl/']]]], [30, b['_rels/.rels'], [[0..4096, b['xl/']]]]]]]],
|
|
2543
2789
|
['image/x-tga', [[1, b["\001\001\000\000"]], [1, b["\000\002\000\000"]], [1, b["\000\003\000\000"]]]],
|
|
2544
2790
|
['application/x-endnote-refer', [[0..50, b['%A '], [[0..1000, b["\n%D "], [[0..1000, b["\n%T "]]]]]]]],
|
|
2545
2791
|
['application/x-tmx', [[0..256, b['<tmx']]]],
|
|
2546
|
-
['image/svg+xml', [[0, b['<?xml'], [[
|
|
2792
|
+
['image/svg+xml', [[0, b['<?xml'], [[21..512, b['<svg']]]]]],
|
|
2547
2793
|
['application/mbox', [[0, b['From '], [[32..256, b["\nFrom: "]], [32..256, b["\nDate: "]], [32..256, b["\nSubject: "]], [32..256, b["\nDelivered-To: "]], [32..256, b["\nReceived: by "]], [32..256, b["\nReceived: via "]], [32..256, b["\nReceived: from "]], [32..256, b["\nMime-Version: "]], [32..256, b["\nX-"], [[32..8192, b["\nFrom: "]], [32..8192, b["\nDate: "]], [32..8192, b["\nSubject: "]], [32..8192, b["\nDelivered-To: "]], [32..8192, b["\nReceived: by "]], [32..8192, b["\nReceived: via "]], [32..8192, b["\nReceived: from "]], [32..8192, b["\nMime-Version: "]]]]]]]],
|
|
2548
2794
|
['application/x-bplist', [[0, b["bplist\000\000"]], [0, b["bplist\000\001"]], [0, b["bplist@\000"]], [0, b['bplist00']], [0, b['bplist01']], [0, b['bplist10']], [0, b['bplist15']], [0, b['bplist16']]]],
|
|
2549
2795
|
['application/x-dvd-ifo', [[0, b['DVDVIDEO-VTS']], [0, b['DVDVIDEO-VMG']]]],
|
|
@@ -2607,7 +2853,6 @@ module Marcel
|
|
|
2607
2853
|
['application/x-stata-dta;version=14', [[0, b['<stata_dta><header><release>118</release>']]]],
|
|
2608
2854
|
['application/x-stata-dta;version=8', [[0, b['<stata_dta><header><release>113</release>']]]],
|
|
2609
2855
|
['application/x-texnicard', [[0, b["SQLite format 3\000"], [[68, b["j\003WD"]]]]]],
|
|
2610
|
-
['application/x-tika-msworks-spreadsheet', [[0..8, b["\320\317\021\340\241\261\032\341"], [[1152..4096, b["W\000k\000s\000S\000S\000W\000o\000r\000k\000B\000o\000o\000k"]]]]]],
|
|
2611
2856
|
['audio/opus', [[0, b['OggS'], [[29, b['pusHead']]]]]],
|
|
2612
2857
|
['audio/speex', [[0, b['OggS'], [[29, b['peex ']]]]]],
|
|
2613
2858
|
['audio/vorbis', [[0, b['OggS'], [[29, b['vorbis']]]]]],
|
|
@@ -2615,13 +2860,7 @@ module Marcel
|
|
|
2615
2860
|
['audio/x-oggflac', [[0, b['OggS'], [[29, b['LAC']]]]]],
|
|
2616
2861
|
['audio/x-oggpcm', [[0, b['OggS'], [[29, b['CM ']]]]]],
|
|
2617
2862
|
['image/avif', [[4, b['ftypavif']]]],
|
|
2618
|
-
['image/heic', [[4, b['ftypheic']], [4, b['ftypheix']]]],
|
|
2619
|
-
['image/heic-sequence', [[4, b['ftyphevc']], [4, b['ftyphevx']]]],
|
|
2620
|
-
['image/heif', [[4, b['ftypmif1']]]],
|
|
2621
|
-
['image/heif-sequence', [[4, b['ftypmsf1']]]],
|
|
2622
2863
|
['image/svg+xml', [[0, b[' <svg']], [0, b["\n<svg"]], [0, b["\r<svg"]], [0, b["\r\n<svg"]], [0, b["\t<svg"]]]],
|
|
2623
|
-
['image/x-canon-cr2', [[0, b["MM\000*"], [[8, b['CR']]]], [0, b["II*\000"], [[8, b['CR']]]], [0, b["MM\000+"], [[8, b['CR']]]]]],
|
|
2624
|
-
['image/x-canon-cr3', [[4, b['ftypcrx ']]]],
|
|
2625
2864
|
['message/news', [[0, b['Path:']], [0, b['Xref:']]]],
|
|
2626
2865
|
['model/e57', [[0, b['ASTM-E57']]]],
|
|
2627
2866
|
['model/vnd.dwf;version=2', [[0, b['(DWF V00.22)']]]],
|
|
@@ -2634,7 +2873,6 @@ module Marcel
|
|
|
2634
2873
|
['video/daala', [[0, b['OggS'], [[29, b['daala']]]]]],
|
|
2635
2874
|
['video/theora', [[0, b['OggS'], [[29, b['theora']]]]]],
|
|
2636
2875
|
['video/x-dirac', [[0, b['OggS'], [[29, b['BCD']]]]]],
|
|
2637
|
-
['video/x-m4v', [[4, b['ftypM4V ']], [4, b['ftypM4VH']], [4, b['ftypM4VP']]]],
|
|
2638
2876
|
['video/x-oggrgb', [[0, b['OggS'], [[29, b['RGB']]]]]],
|
|
2639
2877
|
['video/x-ogguvs', [[0, b['OggS'], [[29, b['VS ']]]]]],
|
|
2640
2878
|
['video/x-oggyuv', [[0, b['OggS'], [[29, b['YUV']]]]]],
|
|
@@ -2661,7 +2899,7 @@ module Marcel
|
|
|
2661
2899
|
['application/java-vm', [[0, b["\312\376\272\276"]]]],
|
|
2662
2900
|
['application/mac-binhex40', [[11, b['must be converted with BinHex']]]],
|
|
2663
2901
|
['application/mathematica', [[0, b['(**']], [0, b['(* ']]]],
|
|
2664
|
-
['application/msword', [[
|
|
2902
|
+
['application/msword', [[0..8, b["\320\317\021\340\241\261\032\341"], [[546, b['jbjb']], [546, b['bjbj']]]]]],
|
|
2665
2903
|
['application/msword2', [[0, b["\233\245"]], [0, b["\333\245"]]]],
|
|
2666
2904
|
['application/msword5', [[0, b["\3767"]]]],
|
|
2667
2905
|
['application/octet-stream', [[10, b['# This is a shell archive']], [0, b["\037\036"]], [0, b["\037\037"]], [0, b["\377\037"]], [0, b["\377\037"]], [0, b["\005\313"]]]],
|
|
@@ -2680,8 +2918,8 @@ module Marcel
|
|
|
2680
2918
|
['application/vnd.digilite.prolights', [[0, b["\177\fD+"]]]],
|
|
2681
2919
|
['application/vnd.fdf', [[0, b['%FDF-']]]],
|
|
2682
2920
|
['application/vnd.iccprofile', [[36, b['acsp']]]],
|
|
2683
|
-
['application/vnd.java.hprof', [[0,
|
|
2684
|
-
['application/vnd.java.hprof.text', [[0,
|
|
2921
|
+
['application/vnd.java.hprof', [[0, Regexp.new("JAVA PROFILE \\d\\.\\d\\.\\d\\u0000".b, 0).freeze]]],
|
|
2922
|
+
['application/vnd.java.hprof.text', [[0, Regexp.new("JAVA PROFILE \\d\\.\\d\\.\\d,".b, 0).freeze]]],
|
|
2685
2923
|
['application/vnd.lotus-1-2-3;version=1', [[0, b["\000\000\002\000\004\004"]]]],
|
|
2686
2924
|
['application/vnd.lotus-1-2-3;version=2', [[0, b["\000\000\002\000\006\004\006\000\b\000"]]]],
|
|
2687
2925
|
['application/vnd.lotus-1-2-3;version=3', [[0, b["\000\000\032\000\000\020\004\000"]]]],
|
|
@@ -2754,7 +2992,7 @@ module Marcel
|
|
|
2754
2992
|
['application/x-endnote-style', [[0, b["\000\b"], [[4, b["\000\000"], [[8, b['RSFTSTYL']], [8, b['ENDNENFT']]]]]]]],
|
|
2755
2993
|
['application/x-erdas-hfa', [[0, b['EHFA_HEADER_TAG']]]],
|
|
2756
2994
|
['application/x-executable', [[0, b["\177ELF"], [[16, b["\002\000"]], [16, b["\000\002"]]]]]],
|
|
2757
|
-
['application/x-fat-diskimage', [[0, b["\\
|
|
2995
|
+
['application/x-fat-diskimage', [[0, b["\\xEB"], [[2, b["\\x90"]]]]]],
|
|
2758
2996
|
['application/x-filemaker', [[14, b["\300HBAM7"], [[525, b["HBAM2101OCT99\301\002H\aPro 7.0\300\300"]]]]]],
|
|
2759
2997
|
['application/x-foxmail', [[0, b["\020\020\020\020\020\020\020\021\021\021\021\021\021S"]]]],
|
|
2760
2998
|
['application/x-gnumeric', [[39, b['=<gmr:Workbook']]]],
|
|
@@ -2905,12 +3143,12 @@ module Marcel
|
|
|
2905
3143
|
['video/x-sgi-movie', [[0, b["MOVI\000"]], [0, b["MOVI\001"]], [0, b["MOVI\002"]], [0, b["MOVI\376"]], [0, b["MOVI\377"]]]],
|
|
2906
3144
|
['application/gzip', [[0, b["\037\213"]], [0, b["\037\213"]]]],
|
|
2907
3145
|
['application/zlib', [[0, b["x\001"]], [0, b['x^']], [0, b["x\234"]], [0, b["x\332"]]]],
|
|
2908
|
-
['image/bmp
|
|
3146
|
+
['image/bmp', [[0, b['BM'], [[26, b["\001\000"], [[28, b["\000\000"]], [28, b["\001\000"]], [28, b["\004\000"]], [28, b["\b\000"]], [28, b["\020\000"]], [28, b["\030\000"]], [28, b[" \000"]]]]]]]],
|
|
2909
3147
|
['message/rfc822', [[0, nil, [[0, nil, [[0, b['Content-ID:']], [0, b['Content-Location:']], [0, b['Content-Transfer-Encoding:']], [0, b['Content-Type:']], [0, b['Date:']], [0, b['Delivered-To:']], [0, b['From:']], [0, b['Message-ID:']], [0, b['MIME-Version:']], [0, b['Received:']], [0, b['Relay-Version:']], [0, b['Return-Path:']], [0, b['Sent:']], [0, b['Status:']], [0, b['Subject:']], [0, b['To:']], [0, b['User-Agent:']], [0, b['X-Mailer:']], [0, b['X-Originating-IP:']], [0, b["\357\273\277"], [[3, b['Content-ID:']], [3, b['Content-Location:']], [3, b['Content-Transfer-Encoding:']], [3, b['Content-Type:']], [3, b['Date:']], [3, b['Delivered-To:']], [3, b['From:']], [3, b['Message-ID:']], [3, b['MIME-Version:']], [3, b['Received:']], [3, b['Relay-Version:']], [3, b['Return-Path:']], [3, b['Sent:']], [3, b['Status:']], [3, b['Subject:']], [3, b['To:']], [3, b['User-Agent:']], [3, b['X-Mailer:']], [3, b['X-Originating-IP:']]]]]], [0, nil, [[0..1024, b["\nContent-ID:"]], [0..1024, b["\nContent-Location:"]], [0..1024, b["\nContent-Transfer-Encoding:"]], [0..1024, b["\nContent-Type:"]], [0..1024, b["\nDate:"]], [0..1024, b["\nDelivered-To:"]], [0..1024, b["\nFrom:"]], [0..1024, b["\nMIME-Version:"]], [0..1024, b["\nReceived:"]], [0..1024, b["\nRelay-Version:"]], [0..1024, b["\nReturn-Path:"]], [0..1024, b["\nSent:"]], [0..1024, b["\nStatus:"]], [0..1024, b["\nSubject:"]], [0..1024, b["\nTo:"]], [0..1024, b["\nUser-Agent:"]], [0..1024, b["\nX-Mailer:"]], [0..1024, b["\nX-Originating-IP:"]], [0..1024, b["\nDKIM-"]], [0..1024, b["\nARC-"]]]]]]]],
|
|
2910
3148
|
['application/pdf', [[0..128, b['%%'], [[1..512, b['%PDF-1.']]]], [0..128, b['%%'], [[1..512, b['%PDF-2.']]]]]],
|
|
2911
3149
|
['application/vnd.wordperfect', [[0, b["\377WPC"]]]],
|
|
2912
3150
|
['application/x-bzip', [[0, b['BZ0']]]],
|
|
2913
|
-
['application/x-bzip2', [[0,
|
|
3151
|
+
['application/x-bzip2', [[0, Regexp.new("BZh[1-9]".b, 0).freeze]]],
|
|
2914
3152
|
['application/x-font-adobe-metric', [[0, b['StartFontMetrics']]]],
|
|
2915
3153
|
['application/x-font-otf', [[0, b["OTTO\000"]]]],
|
|
2916
3154
|
['application/x-font-printer-metric', [[0, b["\000\001"], [[4, b["\000\000Copyr"]]]]]],
|
|
@@ -2925,13 +3163,11 @@ module Marcel
|
|
|
2925
3163
|
['application/x-stata-dta', [[0, b['<stata_dta>']]]],
|
|
2926
3164
|
['application/x-tar', [[257, b["ustar\000"]]]],
|
|
2927
3165
|
['application/x-tika-msoffice', [[0..8, b["\320\317\021\340\241\261\032\341"]]]],
|
|
2928
|
-
['application/xhtml+xml', [[0..8192, b['<html xmlns=']]]],
|
|
2929
3166
|
['audio/ac3', [[0, b["\vw"]]]],
|
|
2930
3167
|
['audio/amr', [[0, b["#!AMR\n"]], [0, b['#!AMR']]]],
|
|
2931
3168
|
['audio/x-aac', [[0, b['ID3']]]],
|
|
2932
3169
|
['image/vnd.zbrush.pcx', [[0, b["\n"], [[1, b["\000"]], [1, b["\002"]], [1, b["\003"]], [1, b["\004"]], [1, b["\005"]]]]]],
|
|
2933
3170
|
['message/rfc822', [[0..1000, b["\nMessage-ID:"]]]],
|
|
2934
|
-
['text/html', [[0..64, b['<!DOCTYPE HTML']], [0..64, b['<!DOCTYPE html']], [0..64, b['<!doctype HTML']], [0..64, b['<!doctype html']], [0..64, b['<HEAD']], [0..64, b['<head']], [0..64, b['<TITLE']], [0..64, b['<title']], [0..64, b['<HTML']], [0..128, b['<html']]]],
|
|
2935
3171
|
['text/vtt', [[0, b["WEBVTT\r"]], [0, b["WEBVTT\n"]], [0, b['0xfeff'], [[2, b["WEBVTT\r"]], [2, b["WEBVTT\n"]]]], [0, b['0xfeff'], [[2, b["WEBVTT\r"]], [2, b["WEBVTT\n"]]]], [0, b['0xefbbbf'], [[3, b["WEBVTT\r"]], [3, b["WEBVTT\n"]]]], [0, b["WEBVTT FILE\r"]], [0, b["WEBVTT FILE\n"]]]],
|
|
2936
3172
|
['application/inf', [[0, b['[version]']], [0, b['[strings]']]]],
|
|
2937
3173
|
['application/x-bibtex-text-file', [[0, b['%'], [[2..128, b["\n@article{"]], [2..128, b["\n@book{"]], [2..128, b["\n@inbook{"]], [2..128, b["\n@incollection{"]], [2..128, b["\n@inproceedings{"]], [2..128, b["\n@manual{"]], [2..128, b["\n@misc{"]], [2..128, b["\n@preamble{"]], [2..128, b["\n@phdthesis{"]], [2..128, b["\n@string{"]], [2..128, b["\n@techreport{"]], [2..128, b["\n@unpublished{"]]]]]],
|
|
@@ -2950,7 +3186,6 @@ module Marcel
|
|
|
2950
3186
|
['audio/x-aiff', [[0, b['FORM'], [[8, b['AIFF']]]], [0, b['FORM'], [[8, b['AIFC']]]], [0, b['FORM'], [[8, b['8SVX']]]], [0, b["FORM\000"]]]],
|
|
2951
3187
|
['audio/x-dec-adpcm', [[0, b["\000ds."], [[12, b["\000\000\000\027"]]]]]],
|
|
2952
3188
|
['audio/x-dec-basic', [[0, b["\000ds."], [[12, b["\000\000\000\001"]], [12, b["\000\000\000\002"]], [12, b["\000\000\000\003"]], [12, b["\000\000\000\004"]], [12, b["\000\000\000\005"]], [12, b["\000\000\000\006"]], [12, b["\000\000\000\a"]]]]]],
|
|
2953
|
-
['text/html', [[128..8192, b['<html']]]],
|
|
2954
3189
|
['text/plain', [[0, b['This is TeX,']], [0, b['This is METAFONT,']], [0, b['/*']], [0, b['//']], [0, b[';;']], [0, b["\376\377"]], [0, b["\377\376"]], [0, b["\357\273\277"]]]],
|
|
2955
3190
|
['text/x-makefile', [[0, b['# Makefile.in generated by']], [0, b['#!make']], [0, b['#!/usr/bin/make']], [0, b['#!/usr/local/bin/make']], [0, b['#!/usr/bin/env make']]]],
|
|
2956
3191
|
['audio/mpeg', [[0, b['ID3']]]],
|
data/lib/marcel/version.rb
CHANGED