diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-01 14:35:26 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-01 14:35:26 +0100 |
commit | 7e9966c5a2fa5d9dd56c3c4b4a123bfbeb020196 (patch) | |
tree | e9fd96b171b9173cd48cb98f4c947a86b9e0c309 /lualib/lua_content/pdf.lua | |
parent | afe627edabb8c8fbf4909cd55deff2935d2d7cc8 (diff) | |
download | rspamd-7e9966c5a2fa5d9dd56c3c4b4a123bfbeb020196.tar.gz rspamd-7e9966c5a2fa5d9dd56c3c4b4a123bfbeb020196.zip |
[Minor] Pdf: Improve logging
Diffstat (limited to 'lualib/lua_content/pdf.lua')
-rw-r--r-- | lualib/lua_content/pdf.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua index f98ad232b..5d6b45ce0 100644 --- a/lualib/lua_content/pdf.lua +++ b/lualib/lua_content/pdf.lua @@ -372,7 +372,7 @@ local function maybe_dereference_object(elt, pdf, task) -- No recursion! return pdf.ref[ref] else - lua_util.debugm(N, task, 'cannot dereference %s:%s -> %s', + lua_util.debugm(N, task, 'cannot dereference %s:%s -> %s, no object', elt[2], elt[3], obj_ref(elt[2], elt[3])) return nil end @@ -683,14 +683,16 @@ process_dict = function(task, pdf, obj, dict) local resources = dict.Resources if resources and type(resources) == 'table' then - obj.resources = maybe_dereference_object(resources, pdf, task) + local res_ref = maybe_dereference_object(resources, pdf, task) - if type(obj.resources) ~= 'table' then - rspamd_logger.infox(task, 'cannot parse resources from pdf: %s returned by grammar', - obj.resources) + if type(res_ref) ~= 'table' then + lua_util.debugm(N, task, 'cannot parse resources from pdf: %s', + resources) + obj.resources = {} + elseif res_ref.dict then + obj.resources = res_ref.dict + else obj.resources = {} - elseif obj.resources.dict then - obj.resources = obj.resources.dict end else -- Fucking pdf: we need to inherit from parent |