commit 7e9966c: [Minor] Pdf: Improve logging
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Jun 1 14:21:06 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-06-01 14:35:26 +0100
URL: https://github.com/rspamd/rspamd/commit/7e9966c5a2fa5d9dd56c3c4b4a123bfbeb020196 (HEAD -> master)
[Minor] Pdf: Improve logging
---
lualib/lua_content/pdf.lua | 16 +++++++++-------
1 file 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
More information about the Commits
mailing list