aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-13 15:37:48 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-13 16:35:43 +0100
commit3dfad0da61cb1bd1b68f9f456d051da3f77996a9 (patch)
tree3957d211e0d0e5fa164070e865861648bd19ecf5 /lualib
parente27069392bd9b5e1ef2eef2ca6eb0ae65e220739 (diff)
downloadrspamd-3dfad0da61cb1bd1b68f9f456d051da3f77996a9.tar.gz
rspamd-3dfad0da61cb1bd1b68f9f456d051da3f77996a9.zip
[Project] Allow rspamd_text based selectors
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_selectors/init.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua
index 7f20e2cbb..11fcd55d1 100644
--- a/lualib/lua_selectors/init.lua
+++ b/lualib/lua_selectors/init.lua
@@ -34,11 +34,14 @@ local logger = require 'rspamd_logger'
local fun = require 'fun'
local lua_util = require "lua_util"
local M = "selectors"
+local rspamd_text = require "rspamd_text"
local E = {}
local extractors = require "lua_selectors/extractors"
local transform_function = require "lua_selectors/transforms"
+local text_cookie = rspamd_text.cookie
+
local function pure_type(ltype)
return ltype:match('^(.*)_list$')
end
@@ -66,6 +69,13 @@ local function process_selector(task, sel)
end
return logger.slog("%s", ud_or_table),'string'
+ elseif t == 'userdata' then
+ if t.cookie and t.cookie == text_cookie then
+ -- Preserve opaque
+ return ud_or_table,'string'
+ else
+ return tostring(ud_or_table),'string'
+ end
else
return tostring(ud_or_table),'string'
end