From ad27730d47ce7b51f242d39d836ce0291c36f97d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 16 May 2025 11:43:39 +0100 Subject: [PATCH] [Minor] Add HEIC files patterns --- lualib/lua_magic/patterns.lua | 17 +++++++++++++++++ lualib/lua_magic/types.lua | 12 +++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lualib/lua_magic/patterns.lua b/lualib/lua_magic/patterns.lua index 971ddd95f..4b19c9fec 100644 --- a/lualib/lua_magic/patterns.lua +++ b/lualib/lua_magic/patterns.lua @@ -466,6 +466,23 @@ local patterns = { }, } }, + heic = { + matches = { + { + -- HEIC/HEIF file format signature + -- Starts with ftyp followed by specific brand identifiers + string = "^....ftyphe[im][cs]", + relative_position = 0, + weight = 60, + }, + { + -- Alternative signature for HEIC/HEIF + string = [[^....ftypmif1]], + relative_position = 0, + weight = 60, + }, + } + }, } return patterns diff --git a/lualib/lua_magic/types.lua b/lualib/lua_magic/types.lua index 3dce2e1f8..f81c1310d 100644 --- a/lualib/lua_magic/types.lua +++ b/lualib/lua_magic/types.lua @@ -279,6 +279,16 @@ local types = { ct = 'image/bmp', av_check = false, }, + heic = { + type = 'image', + ct = 'image/heic', + av_check = false, + }, + heif = { + type = 'image', + ct = 'image/heif', + av_check = false, + }, dwg = { type = 'image', ct = 'image/vnd.dwg', @@ -324,4 +334,4 @@ local types = { }, } -return types \ No newline at end of file +return types