From 7a08e4a48a4bca88c79e7368297872adb69b83ed Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 21 Sep 2018 15:48:20 +0100 Subject: [PATCH] [Fix] Fix lua_util.str_split in case of delimiters set --- lualib/lua_util.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua index 2a2a80fc5..e8fbe2dee 100644 --- a/lualib/lua_util.lua +++ b/lualib/lua_util.lua @@ -46,7 +46,12 @@ local function rspamd_str_split(s, sep) gr = split_grammar[sep] if not gr then - local _sep = lpeg.P(sep) + local _sep + if type(sep) == 'string' then + _sep = lpeg.S(sep) -- Assume set + else + _sep = sep -- Assume lpeg object + end local elem = lpeg.C((1 - _sep)^0) local p = lpeg.Ct(elem * (_sep * elem)^0) gr = p -- 2.39.5