X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fmessage.cc;h=bbfc2500bd92f12dfade22db471fb6b22bf9613b;hp=7e825480ecc6e5782a93113e13b0e9730fac96fc;hb=54ec8a0fd87ae7a32c8208be67a345c0eeea7f69;hpb=1c3b8fba226b4626212a37b503d9ebae3314edf4 diff --git a/lib/message.cc b/lib/message.cc index 7e825480..bbfc2500 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -226,6 +226,10 @@ _notmuch_message_create_for_message_id (notmuch_database_t *notmuch, else if (*status_ret) return NULL; + /* If the message ID is too long, substitute its sha1 instead. */ + if (strlen (message_id) > NOTMUCH_MESSAGE_ID_MAX) + message_id = _notmuch_message_id_compressed (message, message_id); + term = talloc_asprintf (NULL, "%s%s", _find_prefix ("id"), message_id); if (term == NULL) {