aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-09 10:39:01 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-09 10:39:01 +0100
commit1d783faa2abbd9ef7e697b82cb15b21a00cfb08b (patch)
tree7a0e4c6b9232c1ce2331557d267ec86372c3024d /src/plugins
parented963d568f42db5ada19b0f2777ace8f301a563d (diff)
downloadrspamd-1d783faa2abbd9ef7e697b82cb15b21a00cfb08b.tar.gz
rspamd-1d783faa2abbd9ef7e697b82cb15b21a00cfb08b.zip
[Fix] Fix JSON output for history_redis
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/history_redis.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua
index 128d3e20a..13e780e52 100644
--- a/src/plugins/lua/history_redis.lua
+++ b/src/plugins/lua/history_redis.lua
@@ -150,9 +150,8 @@ local function handle_history_request(task, conn, from, to, reset)
local reply = {
version = 2,
}
-
if settings.compress then
- reply.rows = fun.totable(fun.filter(function(e) return e ~= nil end,
+ data = fun.totable(fun.filter(function(e) return e ~= nil end,
fun.map(function(e)
local _,dec = rspamd_util.zstd_decompress(e)
if dec then
@@ -160,9 +159,22 @@ local function handle_history_request(task, conn, from, to, reset)
end
return nil
end, data)))
- else
- reply.rows = data
end
+ -- Parse elements using ucl
+ data = fun.totable(
+ fun.map(function (_, obj) return obj end,
+ fun.filter(function(res, obj) if res then return true end end,
+ fun.map(function(elt)
+ local parser = ucl.parser()
+ local res,_ = parser:parse_string(elt)
+
+ if res then
+ return true, parser:get_object()
+ else
+ return false, nil
+ end
+ end, data))))
+ reply.rows = data
conn:send_ucl(reply)
else
rspamd_logger.errx(task, 'got error %s when getting history: %s',