Browse Source

[Project] Lua_magic: Add more types

tags/2.0
Vsevolod Stakhov 4 years ago
parent
commit
6d97c8f9bf
3 changed files with 20 additions and 0 deletions
  1. 3
    0
      lualib/lua_magic/heuristics.lua
  2. 9
    0
      lualib/lua_magic/patterns.lua
  3. 8
    0
      lualib/lua_magic/types.lua

+ 3
- 0
lualib/lua_magic/heuristics.lua View File

@@ -51,6 +51,7 @@ local zip_patterns = {
[[mimetypeapplication/vnd\.oasis\.opendocument.formula]],
[[mimetypeapplication/vnd\.oasis\.opendocument\.chart]]},
odp = {[[mimetypeapplication/vnd\.oasis\.opendocument\.presentation]]},
epub = {[[epub\+zip]]}
}

-- Used to match pattern index and extension
@@ -236,6 +237,8 @@ local function detect_archive_flaw(part, arch, log_obj)
res.docx = res.docx + 30
elseif file:sub(1, 4) == 'ppt/' then
res.pptx = res.pptx + 30
elseif file == 'META-INF/MANIFEST.MF' then
res.jar = res.jar + 40
end
end


+ 9
- 0
lualib/lua_magic/patterns.lua View File

@@ -224,6 +224,15 @@ local patterns = {
},
}
},
xar = {
matches = {
{
string = [[xar!]],
relative_position = 0,
weight = 60,
},
}
},
iso = {
matches = {
{

+ 8
- 0
lualib/lua_magic/types.lua View File

@@ -105,6 +105,14 @@ local types = {
ct = 'application/x-zoo',
type = 'archive',
},
xar = {
ct = 'application/x-xar',
type = 'archive',
},
epub = {
ct = 'application/x-epub',
type = 'archive'
},
szdd = { -- in fact, their MSDOS extension is like FOO.TX_ or FOO.TX$
ct = 'application/x-compressed',
type = 'archive',

Loading…
Cancel
Save