mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-23 03:18:08 +01:00
add_message: Re-fix handling of non-mail files.
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.
This commit is contained in:
parent
656e4c413d
commit
3ae12b1e28
2 changed files with 6 additions and 6 deletions
|
@ -323,7 +323,7 @@ _parse_message_id (void *ctx, const char *message_id, const char **next)
|
||||||
const char *s, *end;
|
const char *s, *end;
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
if (message_id == NULL)
|
if (message_id == NULL || *message_id == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
s = message_id;
|
s = message_id;
|
||||||
|
@ -391,7 +391,7 @@ parse_references (void *ctx,
|
||||||
{
|
{
|
||||||
char *ref;
|
char *ref;
|
||||||
|
|
||||||
if (refs == NULL)
|
if (refs == NULL || *refs == '\0')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (*refs) {
|
while (*refs) {
|
||||||
|
@ -896,9 +896,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
|
||||||
subject = notmuch_message_file_get_header (message_file, "subject");
|
subject = notmuch_message_file_get_header (message_file, "subject");
|
||||||
to = notmuch_message_file_get_header (message_file, "to");
|
to = notmuch_message_file_get_header (message_file, "to");
|
||||||
|
|
||||||
if (from == NULL &&
|
if ((from == NULL || *from == '\0') &&
|
||||||
subject == NULL &&
|
(subject == NULL || *subject == '\0') &&
|
||||||
to == NULL)
|
(to == NULL || *to == '\0'))
|
||||||
{
|
{
|
||||||
ret = NOTMUCH_STATUS_FILE_NOT_EMAIL;
|
ret = NOTMUCH_STATUS_FILE_NOT_EMAIL;
|
||||||
goto DONE;
|
goto DONE;
|
||||||
|
|
|
@ -491,7 +491,7 @@ _notmuch_message_set_date (notmuch_message_t *message,
|
||||||
|
|
||||||
/* GMime really doesn't want to see a NULL date, so protect its
|
/* GMime really doesn't want to see a NULL date, so protect its
|
||||||
* sensibilities. */
|
* sensibilities. */
|
||||||
if (date == NULL)
|
if (date == NULL || *date == '\0')
|
||||||
time_value = 0;
|
time_value = 0;
|
||||||
else
|
else
|
||||||
time_value = g_mime_utils_header_decode_date (date, NULL);
|
time_value = g_mime_utils_header_decode_date (date, NULL);
|
||||||
|
|
Loading…
Reference in a new issue