commit 60173e2: [Minor] Sort urls for mime parts

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 22 16:14:11 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-02-22 16:09:09 +0000
URL: https://github.com/rspamd/rspamd/commit/60173e2236cdd2f9c9ee6a8c777cd29e6b1639f5

[Minor] Sort urls for mime parts

---
 src/libmime/message.c | 2 ++
 src/libserver/url.c   | 1 +
 2 files changed, 3 insertions(+)

diff --git a/src/libmime/message.c b/src/libmime/message.c
index 99b84e385..a4b357015 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -771,6 +771,8 @@ rspamd_message_process_html_text_part (struct rspamd_task *task,
 			MESSAGE_FIELD (task, urls),
 			text_part->mime_part->urls);
 
+	g_ptr_array_sort (text_part->mime_part->urls, rspamd_url_cmp_qsort);
+
 	if (text_part->utf_content->len == 0) {
 		text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_EMPTY;
 	}
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 094456d7b..b371b78f4 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -3473,6 +3473,7 @@ rspamd_url_text_extract (rspamd_mempool_t *pool,
 	rspamd_url_find_multiple (task->task_pool, part->utf_stripped_content->data,
 			part->utf_stripped_content->len, how, part->newlines,
 			rspamd_url_text_part_callback, &mcbd);
+	g_ptr_array_sort (part->mime_part->urls, rspamd_url_cmp_qsort);
 }
 
 void


More information about the Commits mailing list