commit 89db324: [Minor] Fix default behaviour of task:get_urls

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Apr 29 19:14:12 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-04-29 20:08:25 +0100
URL: https://github.com/rspamd/rspamd/commit/89db3241edf1fcb5856882acf95b7f5f54eea71a (HEAD -> master)

[Minor] Fix default behaviour of task:get_urls

---
 src/lua/lua_task.c | 4 ++--
 src/lua/lua_url.c  | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 1ca96ed76..51936a532 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2274,7 +2274,7 @@ lua_task_get_urls (lua_State * L)
 
 		/* Exclude RSPAMD_URL_FLAG_CONTENT to preserve backward compatibility */
 		if (!lua_url_cbdata_fill (L, 2, &cb, default_protocols_mask,
-				(~RSPAMD_URL_FLAG_CONTENT), max_urls)) {
+				~(RSPAMD_URL_FLAG_CONTENT|RSPAMD_URL_FLAG_IMAGE), max_urls)) {
 			return luaL_error (L, "invalid arguments");
 		}
 
@@ -2433,7 +2433,7 @@ lua_task_get_emails (lua_State * L)
 	if (task) {
 		if (task->message) {
 			if (!lua_url_cbdata_fill (L, 2, &cb, PROTOCOL_MAILTO,
-					(~RSPAMD_URL_FLAG_CONTENT), max_urls)) {
+					~(RSPAMD_URL_FLAG_CONTENT|RSPAMD_URL_FLAG_IMAGE), max_urls)) {
 				return luaL_error (L, "invalid arguments");
 			}
 
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index ed1eb1901..6652fdaac 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -1035,6 +1035,9 @@ lua_url_cbdata_fill (lua_State *L,
 					flags_mask &= ~RSPAMD_URL_FLAG_IMAGE;
 				}
 			}
+			else {
+				flags_mask &= ~RSPAMD_URL_FLAG_IMAGE;
+			}
 			lua_pop (L, 1);
 
 			lua_getfield (L, pos, "content");
@@ -1046,6 +1049,9 @@ lua_url_cbdata_fill (lua_State *L,
 					flags_mask &= ~RSPAMD_URL_FLAG_CONTENT;
 				}
 			}
+			else {
+				flags_mask &= ~RSPAMD_URL_FLAG_CONTENT;
+			}
 			lua_pop (L, 1);
 
 			lua_getfield (L, pos, "max_urls");


More information about the Commits mailing list