commit 149d5d9: [Minor] Lua_content: Allow multiple content types to be matched

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Nov 20 11:28:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-11-20 11:23:28 +0000
URL: https://github.com/rspamd/rspamd/commit/149d5d9ba3fed43562b16911cadf78c53201c0a7

[Minor] Lua_content: Allow multiple content types to be matched

---
 lualib/lua_content/init.lua | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lualib/lua_content/init.lua b/lualib/lua_content/init.lua
index c23ca9d09..7bf42b9a1 100644
--- a/lualib/lua_content/init.lua
+++ b/lualib/lua_content/init.lua
@@ -26,9 +26,9 @@ local lua_util = require "lua_util"
 
 local content_modules = {
   ical = {
-    mime_type = "text/calendar",
+    mime_type = {"text/calendar", "application/calendar"},
     module = require "lua_content/ical",
-    extensions = {'ical'},
+    extensions = {'ics'},
     output = "text"
   },
   pdf = {
@@ -47,7 +47,14 @@ local function init()
   modules_by_extension = {}
   for k,v in pairs(content_modules) do
     if v.mime_type then
-      modules_by_mime_type[v.mime_type] = {k, v}
+      if type(v.mime_type) == 'table' then
+        for _,mt in ipairs(v.mime_type) do
+          modules_by_mime_type[mt] = {k, v}
+        end
+      else
+        modules_by_mime_type[v.mime_type] = {k, v}
+      end
+
     end
     if v.extensions then
       for _,ext in ipairs(v.extensions) do


More information about the Commits mailing list