diff options
Diffstat (limited to 'camel/camel-mime-parser.c')
-rw-r--r-- | camel/camel-mime-parser.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index acb29814d2..c8dc4fb61c 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -1102,18 +1102,34 @@ retry: start = inptr; - if (!s->midline - && (part = folder_boundary_check(s, inptr, lastone))) { - if ((s->outptr>s->outbuf) || (inptr-start)) - goto header_truncated; /* may not actually be truncated */ - - goto normal_exit; + if (!s->midline) { + if ((part = folder_boundary_check(s, inptr, lastone))) { + if ((s->outptr>s->outbuf) || (inptr-start)) + goto header_truncated; /* may not actually be truncated */ + + goto normal_exit; + } + + /* Replace any number of spaces and tabs at the start of the line with + * a single space. + */ + if (*start == ' ' || *start == '\t') { + static char *space = " "; + do + start++; + while (*start == ' ' || *start == '\t'); + header_append(s, space, space + 1); + } } /* goto next line */ while ((*inptr++)!='\n') ; + g_assert(inptr<=s->inend+1); + + header_append(s, start, inptr-1); + /* check against the real buffer end, not our 'atleast limited' end */ /* also make sure we have at least 1 char lookahead, so even if we found a \n at the end, well, make out we didn't, and re-scan it next pass */ @@ -1124,10 +1140,6 @@ retry: s->midline = FALSE; } - g_assert(inptr<=s->inend); - - header_append(s, start, inptr); - h(printf("outbuf[0] = %02x '%c' oubuf[1] = %02x '%c'\n", s->outbuf[0], isprint(s->outbuf[0])?s->outbuf[0]:'.', s->outbuf[1], isprint(s->outbuf[1])?s->outbuf[1]:'.')); |