aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-17 12:15:44 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-17 12:15:44 +0000
commitc2f53048d6236c85fd76b08eb2ff484a0a7e2ec3 (patch)
treefcf0eaef33a42908e8e991410f4111b76ec57de7 /src
parent337c39f4834384f822f73cc2a07abea1e74b9a65 (diff)
downloadrspamd-c2f53048d6236c85fd76b08eb2ff484a0a7e2ec3.tar.gz
rspamd-c2f53048d6236c85fd76b08eb2ff484a0a7e2ec3.zip
[Feature] Allow regexp maps for mime types
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/mime_types.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index 7cc0043a1..0bfe42fe0 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -86,16 +86,19 @@ if opts then
end
if settings['file'] and #settings['file'] > 0 then
- map = rspamd_config:add_kv_map (settings['file'],
- 'mime types map')
- if map then
- local id = rspamd_config:register_callback_symbol(1.0, check_mime_type)
- rspamd_config:register_virtual_symbol(settings['symbol_unknown'], 1.0, id)
- rspamd_config:register_virtual_symbol(settings['symbol_bad'], 1.0, id)
- rspamd_config:register_virtual_symbol(settings['symbol_good'], 1.0, id)
+
+ if settings['regexp'] then
+ map = rspamd_config:add_map ({
+ url = settings['file'],
+ type = 'regexp',
+ description = 'mime types map'
+ })
else
- rspamd_logger.warnx(rspamd_config, 'Cannot add mime_types: map doesn\'t exists: %1',
- settings['file'])
+ map = rspamd_config:add_map ({
+ url = settings['file'],
+ type = 'map',
+ description = 'mime types map'
+ })
end
local id = rspamd_config:register_callback_symbol(1.0, check_mime_type)
rspamd_config:register_virtual_symbol(settings['symbol_unknown'], 1.0, id)