aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-20 12:40:29 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-01-20 12:40:29 +0000
commitc4cdc7a35003eafb1baa2a3bf5f1c48d89465e63 (patch)
treecc334eba59da35f9be89e468c654a5438c788d04 /lualib
parent978f5e47d0607832c9f832b9708452b9f9d4e2fb (diff)
downloadrspamd-c4cdc7a35003eafb1baa2a3bf5f1c48d89465e63.tar.gz
rspamd-c4cdc7a35003eafb1baa2a3bf5f1c48d89465e63.zip
[Minor] Filter crap from javascript
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_content/pdf.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/lualib/lua_content/pdf.lua b/lualib/lua_content/pdf.lua
index e64ac86e4..6ede52c76 100644
--- a/lualib/lua_content/pdf.lua
+++ b/lualib/lua_content/pdf.lua
@@ -524,7 +524,7 @@ local function process_action(task, pdf, obj)
if not pdf.scripts then
pdf.scripts = {}
end
- obj.js = rspamd_text.fromstring(js)
+ obj.js = rspamd_text.fromstring(js):exclude_chars('%n%c')
pdf.scripts[#pdf.scripts + 1] = obj.js
lua_util.debugm(N, task, 'extracted javascript from %s:%s: %s',
obj.major, obj.minor, obj.js)
@@ -532,10 +532,10 @@ local function process_action(task, pdf, obj)
if not pdf.scripts then
pdf.scripts = {}
end
- obj.js = js
- pdf.scripts[#pdf.scripts + 1] = js
+ obj.js = js:exclude_chars('%n%c')
+ pdf.scripts[#pdf.scripts + 1] = obj.js
lua_util.debugm(N, task, 'extracted javascript from %s:%s: %s',
- obj.major, obj.minor, js)
+ obj.major, obj.minor, obj.js)
else
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s',
obj.major, obj.minor, js)