From 7de4fc78131a5aeeb619e0559a57582105ac278b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 25 Sep 2025 10:40:22 +0100 Subject: [PATCH] [Fix] Fix XML prolog detection in lua_magic --- lualib/lua_magic/patterns.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lualib/lua_magic/patterns.lua b/lualib/lua_magic/patterns.lua index b51deab7f6..df524f177c 100644 --- a/lualib/lua_magic/patterns.lua +++ b/lualib/lua_magic/patterns.lua @@ -448,14 +448,24 @@ local patterns = { { -- Case-insensitive in the first chunk string = [[(?i)=', 0 }, + position = { '<=', 4096 }, + weight = 40, + }, + { + -- Case-insensitive within the first 4KiB + string = [[(?i)]], position = { '>=', 0 }, - weight = 20, + weight = 30, }, } }, -- 2.47.3