]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: Don't send binary MIME parts to backend through UTF8 text conversion.
authorTimo Sirainen <tss@iki.fi>
Fri, 22 Feb 2013 08:17:14 +0000 (10:17 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 22 Feb 2013 08:17:14 +0000 (10:17 +0200)
Based on patch by Mike Abbott / Apple.

src/plugins/fts/fts-build-mail.c

index c6cec4314f459145afa246ec17855f74df6c6cdb..31f50c8d4d3e6d398643fa50b90f924640f8016c 100644 (file)
@@ -170,6 +170,7 @@ fts_build_body_begin(struct fts_mail_build_context *ctx, bool *binary_body_r)
                   strncmp(content_type, "message/", 8) == 0) {
                /* text body parts */
                key.type = FTS_BACKEND_BUILD_KEY_BODY_PART;
+               ctx->body_parser = fts_parser_text_init();
        } else {
                /* possibly binary */
                if ((ctx->update_ctx->backend->flags &
@@ -178,8 +179,6 @@ fts_build_body_begin(struct fts_mail_build_context *ctx, bool *binary_body_r)
                *binary_body_r = TRUE;
                key.type = FTS_BACKEND_BUILD_KEY_BODY_PART_BINARY;
        }
-       if (ctx->body_parser == NULL)
-               ctx->body_parser = fts_parser_text_init();
        key.body_content_type = content_type;
        key.body_content_disposition = ctx->content_disposition;
        return fts_backend_update_set_build_key(ctx->update_ctx, &key);