aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_util.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-21 15:48:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-21 15:48:20 +0100
commit7a08e4a48a4bca88c79e7368297872adb69b83ed (patch)
tree9ea5c410e547a9b98caf6c92b771a0097c76918c /lualib/lua_util.lua
parent5fc95db5da1f3f099bd6be53dea965bcea669307 (diff)
downloadrspamd-7a08e4a48a4bca88c79e7368297872adb69b83ed.tar.gz
rspamd-7a08e4a48a4bca88c79e7368297872adb69b83ed.zip
[Fix] Fix lua_util.str_split in case of delimiters set
Diffstat (limited to 'lualib/lua_util.lua')
-rw-r--r--lualib/lua_util.lua7
1 files changed, 6 insertions, 1 deletions
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