# HG changeset patch # User Timo Sirainen # Date 1277301589 -3600 # Node ID 659f72bf92ae443feab55987bd15c31b0fe7acb8 # Parent 97b702abd1328434f78047e0783cdf5789600035 lib-storage: When getting decoded headers, don't fail when MIME encoded-words expand to LFs. This fixes errors like: Corrupted index cache file dovecot.index.cache: Broken header Subject for mail UID 1 diff -r 97b702abd132 -r 659f72bf92ae src/lib-storage/index/index-mail-headers.c --- a/src/lib-storage/index/index-mail-headers.c Mon Jun 21 21:17:58 2010 +0100 +++ b/src/lib-storage/index/index-mail-headers.c Wed Jun 23 14:59:49 2010 +0100 @@ -722,13 +722,14 @@ for (i = 0; i < count; i++) { str_truncate(str, 0); input = list[i]; + /* unfold all lines into a single line */ + if (unfold_header(mail->data_pool, &input) < 0) + return -1; + + /* decode MIME encoded-words. decoding may also add new LFs. */ if (message_header_decode_utf8((const unsigned char *)input, strlen(list[i]), str, FALSE)) - input = str_c(str); - if (unfold_header(mail->data_pool, &input) < 0) - return -1; - if (input == str->data) - input = p_strdup(mail->data_pool, input); + input = p_strdup(mail->data_pool, str_c(str)); decoded_list[i] = input; } *_list = decoded_list;