diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-05-05 15:11:40 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-05-05 15:11:40 +0100 |
commit | 4fd673f08e5ca4b0a2f4df97043571f5618c4c94 (patch) | |
tree | d8845c542e3a560187f16ac1a4e99f5710695e7d /src/lua | |
parent | 5dd1ccbb33e53b9a3903970bbd623569869ad008 (diff) | |
download | rspamd-4fd673f08e5ca4b0a2f4df97043571f5618c4c94.tar.gz rspamd-4fd673f08e5ca4b0a2f4df97043571f5618c4c94.zip |
[Minor] Attach pdf urls to mime parts
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 51936a532..98c0b06ed 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -2333,9 +2333,21 @@ lua_task_inject_url (lua_State * L) LUA_TRACE_POINT; struct rspamd_task *task = lua_check_task (L, 1); struct rspamd_lua_url *url = lua_check_url (L, 2); + struct rspamd_mime_part *mpart = NULL; + + if (lua_isuserdata (L, 3)) { + /* We also have a mime part there */ + mpart = *((struct rspamd_mime_part **)rspamd_lua_check_udata_maybe (L, + 3, "rspamd{mimepart}")); + } if (task && task->message && url && url->url) { - rspamd_url_set_add_or_increase (MESSAGE_FIELD (task, urls), url->url); + if (rspamd_url_set_add_or_increase (MESSAGE_FIELD (task, urls), url->url)) { + if (mpart && mpart->urls) { + /* Also add url to the mime part */ + g_ptr_array_add (mpart->urls, url->url); + } + } } else { return luaL_error (L, "invalid arguments"); |