If message body starts with a single char + space (e.g. "I am"), the
space is wrongly removed (i.e. snippet would be "Iam") because at least two
non-whitespace characters are expected. Fix the minimum to 1 to fix this.
}
if (i_isspace(*data)) {
/* skip any leading whitespace */
- if (str_len(target->snippet) > 1)
+ if (str_len(target->snippet) > 0)
ctx->add_whitespace = TRUE;
if (data[0] == '\n')
ctx->state = SNIPPET_STATE_NEWLINE;
"</div><br =class=3D\"\"></body></html>=\n",
100,
">quoted text is included" },
+ { "Content-Type: text/plain; charset=utf-8\n"
+ "\n"
+ "I think\n",
+ 100,
+ "I think"
+ },
+ { "Content-Type: text/plain; charset=utf-8\n"
+ "\n"
+ " Lorem Ipsum\n",
+ 100,
+ "Lorem Ipsum"
+ },
+ { "Content-Type: text/plain; charset=utf-8\n"
+ "\n"
+ " I think\n",
+ 100,
+ "I think"
+ },
+ { "Content-Type: text/plain; charset=utf-8\n"
+ "\n"
+ " A cat\n",
+ 100,
+ "A cat"
+ },
+ { "Content-Type: text/plain; charset=utf-8\n"
+ "\n"
+ " \n",
+ 100,
+ ""
+ },
};
static void test_message_snippet(void)