commit 626107b: [Minor] Fix a455c6542212948969b6c115344e9d059606407a missing part

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 3 17:21:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-03 17:19:47 +0000
URL: https://github.com/rspamd/rspamd/commit/626107bb0f5593506230940a7d9b53d1b5f06d99 (HEAD -> master)

[Minor] Fix a455c6542212948969b6c115344e9d059606407a missing part

---
 src/libmime/message.h       | 2 +-
 src/libmime/mime_encoding.c | 4 ++++
 src/lua/lua_mimepart.c      | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/libmime/message.h b/src/libmime/message.h
index c11b273eb..eeba0a053 100644
--- a/src/libmime/message.h
+++ b/src/libmime/message.h
@@ -114,7 +114,7 @@ struct rspamd_mime_part {
 #define RSPAMD_MIME_TEXT_PART_FLAG_BALANCED (1 << 1)
 #define RSPAMD_MIME_TEXT_PART_FLAG_EMPTY (1 << 2)
 #define RSPAMD_MIME_TEXT_PART_FLAG_HTML (1 << 3)
-#define RSPAMD_MIME_TEXT_PART_FLAG_8BIT (1 << 4)
+#define RSPAMD_MIME_TEXT_PART_FLAG_8BIT_RAW (1 << 4)
 #define RSPAMD_MIME_TEXT_PART_FLAG_8BIT_ENCODED (1 << 5)
 #define RSPAMD_MIME_TEXT_PART_HAS_SUBNORMAL (1 << 6)
 #define RSPAMD_MIME_TEXT_PART_NORMALISED (1 << 7)
diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c
index a91447ab6..47295d95b 100644
--- a/src/libmime/mime_encoding.c
+++ b/src/libmime/mime_encoding.c
@@ -659,6 +659,10 @@ rspamd_mime_text_part_maybe_convert (struct rspamd_task *task,
 	rspamd_ftok_t charset_tok;
 	struct rspamd_mime_part *part = text_part->mime_part;
 
+	if (rspamd_str_has_8bit (text_part->raw.begin, text_part->raw.len)) {
+		text_part->flags |= RSPAMD_MIME_TEXT_PART_FLAG_8BIT_RAW;
+	}
+
 	/* Allocate copy storage */
 	part_content = g_byte_array_sized_new (text_part->parsed.len);
 	memcpy (part_content->data, text_part->parsed.begin, text_part->parsed.len);
diff --git a/src/lua/lua_mimepart.c b/src/lua/lua_mimepart.c
index c221cbfa3..7ce6d251d 100644
--- a/src/lua/lua_mimepart.c
+++ b/src/lua/lua_mimepart.c
@@ -625,7 +625,7 @@ lua_textpart_has_8bit_raw (lua_State * L)
 	struct rspamd_mime_text_part *part = lua_check_textpart (L);
 
 	if (part) {
-		if (part->flags & RSPAMD_MIME_TEXT_PART_FLAG_8BIT) {
+		if (part->flags & RSPAMD_MIME_TEXT_PART_FLAG_8BIT_RAW) {
 			lua_pushboolean (L, TRUE);
 		}
 		else {


More information about the Commits mailing list