]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] More tags output fixes
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Jul 2021 16:53:01 +0000 (17:53 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Jul 2021 16:53:01 +0000 (17:53 +0100)
lualib/rspamadm/mime.lua

index a92c8c01c417bc22d0967d6cc3b289891c20e29a..9dc387ef01bb747d642db1aabc5a6981748283a4 100644 (file)
@@ -386,28 +386,38 @@ local function extract_handler(opts)
               local hc = part:get_html()
               local res = {}
               process_func = function(elt)
-                return rspamd_logger.slog("%s", elt)
+                local fun = require "fun"
+                if type(elt) == 'table' then
+                  return table.concat(fun.totable(
+                      fun.map(
+                          function(t)
+                            return rspamd_logger.slog("%s", t)
+                          end,
+                          elt)), '\n')
+                else
+                  return rspamd_logger.slog("%s", elt)
+                end
               end
 
               hc:foreach_tag('any', function(tag)
-                local elt = {}
-                local ex = tag:get_extra()
-                elt.tag = tag:get_type()
-                if ex then
-                  elt.extra = ex
-                end
-                local content = tag:get_content()
-                if content then
-                  elt.content = tostring(content)
-                end
-                local style = tag:get_style()
-                if style then
-                  elt.style = style
-                end
-                table.insert(res, elt)
+                  local elt = {}
+                  local ex = tag:get_extra()
+                  elt.tag = tag:get_type()
+                  if ex then
+                    elt.extra = ex
+                  end
+                  local content = tag:get_content()
+                  if content then
+                    elt.content = tostring(content)
+                  end
+                  local style = tag:get_style()
+                  if style then
+                    elt.style = style
+                  end
+                  table.insert(res, elt)
               end)
               table.insert(out_elts[fname], res)
-            else
+            else -- opts.structure
               table.insert(out_elts[fname], tostring(part:get_content(how)))
             end
           end