aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-31 13:27:17 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-31 13:27:17 +0100
commitd0543dbf5628edf422859d9b230152acc1d7291f (patch)
tree519fe924d63f6eb8cf97e71e60249c2cf55bbfe6 /src/libmime
parenta3ef64be4a40f1a57914573d8f686a398652640b (diff)
downloadrspamd-d0543dbf5628edf422859d9b230152acc1d7291f.tar.gz
rspamd-d0543dbf5628edf422859d9b230152acc1d7291f.zip
Do not convert utf to utf.
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/message.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index f8ae25554..ebf12b413 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -986,6 +986,7 @@ convert_text_to_utf (struct rspamd_task *task,
text_part->is_raw = TRUE;
return part_content;
}
+
if (g_ascii_strcasecmp (ocharset,
"utf-8") == 0 || g_ascii_strcasecmp (ocharset, "utf8") == 0) {
if (g_utf8_validate (part_content->data, part_content->len, NULL)) {
@@ -1001,20 +1002,22 @@ convert_text_to_utf (struct rspamd_task *task,
return part_content;
}
}
-
- res_str = rspamd_text_to_utf8 (task, part_content->data,
- part_content->len,
- ocharset,
- &write_bytes,
- &err);
- if (res_str == NULL) {
- msg_warn ("<%s>: cannot convert from %s to utf8: %s",
- task->message_id,
- ocharset,
- err ? err->message : "unknown problem");
- text_part->is_raw = TRUE;
- g_error_free (err);
- return part_content;
+ else {
+ res_str = rspamd_text_to_utf8 (task, part_content->data,
+ part_content->len,
+ ocharset,
+ &write_bytes,
+ &err);
+ if (res_str == NULL) {
+ msg_warn ("<%s>: cannot convert from %s to utf8: %s",
+ task->message_id,
+ ocharset,
+ err ? err->message : "unknown problem");
+ text_part->is_raw = TRUE;
+ text_part->is_utf = FALSE;
+ g_error_free (err);
+ return part_content;
+ }
}
result_array = rspamd_mempool_alloc (task->task_pool, sizeof (GByteArray));