From d0619b1db297b86540319c2c051cc9977ec2e090 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Tue, 19 Apr 2022 00:04:01 +0300 Subject: [PATCH] server: workaround for broken message-id We cannot really _search_ for the broken message-id, but we can still view it. Should help for issue #2232. --- lib/message/test-mu-message.cc | 8 +++++--- lib/mu-server.cc | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/message/test-mu-message.cc b/lib/message/test-mu-message.cc index 257b4edd..4e0e5fa7 100644 --- a/lib/message/test-mu-message.cc +++ b/lib/message/test-mu-message.cc @@ -137,7 +137,7 @@ To: bar@example.com Subject: =?utf-8?B?w6R0dMOkY2htZcOxdHM=?= Date: Thu, 24 Mar 2022 20:04:39 +0200 Organization: ACME Inc. -Message-ID: <87a6dfw7bg.fsf@example.com> +Message-Id: <3144HPOJ0VC77.3H1XTAG2AMTLH@"@WILSONB.COM> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" @@ -195,6 +195,10 @@ World! assert_equal(from.at(0).name, "Foo Example"); assert_equal(from.at(0).email, "foo@example.com"); + // problem case: https://github.com/djcb/mu/issues/2232o + assert_equal(message->message_id(), + "3144HPOJ0VC77.3H1XTAG2AMTLH@\"@WILSONB.COM"); + g_assert_true(message->path().empty()); g_assert_true(message->priority() == Priority::Normal); g_assert_cmpuint(message->size(),==,::strlen(msg_text)); @@ -449,8 +453,6 @@ C0bdoCx44QVU8HaZ2x91h3GoM/0q5bqM/rvCauwbokiJgAUrznecNPY= g_assert_cmpuint(n, ==, 1); } - - int main(int argc, char* argv[]) { diff --git a/lib/mu-server.cc b/lib/mu-server.cc index 29657cd3..047d274f 100644 --- a/lib/mu-server.cc +++ b/lib/mu-server.cc @@ -1076,8 +1076,8 @@ Server::Private::maybe_mark_as_read(MuMsg* msg, Store::Id docid, bool rename) } bool -Server::Private::maybe_mark_msgid_as_read(const char* msgid, bool rename) -{ +Server::Private::maybe_mark_msgid_as_read(const char* msgid, bool rename) try { + if (!msgid) return false; // nothing to do. @@ -1095,6 +1095,9 @@ Server::Private::maybe_mark_msgid_as_read(const char* msgid, bool rename) } return true; +} catch (...) { /* not fatal */ + g_warning("failed to mark <%s> as read", msgid); + return false; } void