More fallout from _get_header now returning "" for missing headers.
The bug here is that we would no longer detect that a file is not an
email message and give up on it like we should.
And this time, I actually audited all callers to
notmuch_message_get_header, so hopefully we're done fixing this
bug over and over.
const char *s, *end;
char *result;
- if (message_id == NULL)
+ if (message_id == NULL || *message_id == '\0')
return NULL;
s = message_id;
{
char *ref;
- if (refs == NULL)
+ if (refs == NULL || *refs == '\0')
return;
while (*refs) {
subject = notmuch_message_file_get_header (message_file, "subject");
to = notmuch_message_file_get_header (message_file, "to");
- if (from == NULL &&
- subject == NULL &&
- to == NULL)
+ if ((from == NULL || *from == '\0') &&
+ (subject == NULL || *subject == '\0') &&
+ (to == NULL || *to == '\0'))
{
ret = NOTMUCH_STATUS_FILE_NOT_EMAIL;
goto DONE;
/* GMime really doesn't want to see a NULL date, so protect its
* sensibilities. */
- if (date == NULL)
+ if (date == NULL || *date == '\0')
time_value = 0;
else
time_value = g_mime_utils_header_decode_date (date, NULL);