aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-05-16 16:05:43 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-05-16 16:05:43 +0100
commitbecf47bff76a0d1c9be00bdc2abe3a6e948862e3 (patch)
treed6d427910114957b0713b06c7f0335bba42b05ce /lualib
parentcb038700560b6a16980229b26feed72a0ceeba5b (diff)
downloadrspamd-becf47bff76a0d1c9be00bdc2abe3a6e948862e3.tar.gz
rspamd-becf47bff76a0d1c9be00bdc2abe3a6e948862e3.zip
[Minor] Improve string splitting
Diffstat (limited to 'lualib')
-rw-r--r--lualib/rspamadm/dmarc_report.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua
index a54e12d67..e6b3a218a 100644
--- a/lualib/rspamadm/dmarc_report.lua
+++ b/lualib/rspamadm/dmarc_report.lua
@@ -24,6 +24,7 @@ local rspamd_url = require "rspamd_url"
local rspamd_text = require "rspamd_text"
local rspamd_util = require "rspamd_util"
local rspamd_dns = require "rspamd_dns"
+local fun = require "fun"
local N = 'dmarc_report'
@@ -288,11 +289,9 @@ end
-- Process a single rua entry, validating in DNS if needed
local function process_rua(dmarc_domain, rua)
- local parts = lua_util.str_split(rua, ',')
-
-- Remove size limitation, as we don't care about them
local addrs = {}
- for _, rua_part in ipairs(parts) do
+ for rua_part in fun.map(lua_util.str_trim, lua_util.str_split(rua, ',')) do
local u = rspamd_url.create(pool, rua_part:gsub('!%d+[kmg]?$', ''))
local u2 = rspamd_url.create(pool, dmarc_domain)
if u and (u:get_protocol() or '') == 'mailto' and u:get_user() then
@@ -331,7 +330,7 @@ local function process_rua(dmarc_domain, rua)
end
end
else
- logger.errx('invalid rua url: "%s""', tostring(u or 'null'))
+ logger.errx('invalid rua url: "%s""', rua_part)
end
end