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.
This commit is contained in:
Dirk-Jan C. Binnema 2022-04-19 00:04:01 +03:00
parent 1ff161d91b
commit d0619b1db2
2 changed files with 10 additions and 5 deletions

View File

@ -137,7 +137,7 @@ To: bar@example.com
Subject: =?utf-8?B?w6R0dMOkY2htZcOxdHM=?= Subject: =?utf-8?B?w6R0dMOkY2htZcOxdHM=?=
Date: Thu, 24 Mar 2022 20:04:39 +0200 Date: Thu, 24 Mar 2022 20:04:39 +0200
Organization: ACME Inc. Organization: ACME Inc.
Message-ID: <87a6dfw7bg.fsf@example.com> Message-Id: <3144HPOJ0VC77.3H1XTAG2AMTLH@"@WILSONB.COM>
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-=" Content-Type: multipart/mixed; boundary="=-=-="
@ -195,6 +195,10 @@ World!
assert_equal(from.at(0).name, "Foo Example"); assert_equal(from.at(0).name, "Foo Example");
assert_equal(from.at(0).email, "foo@example.com"); 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->path().empty());
g_assert_true(message->priority() == Priority::Normal); g_assert_true(message->priority() == Priority::Normal);
g_assert_cmpuint(message->size(),==,::strlen(msg_text)); g_assert_cmpuint(message->size(),==,::strlen(msg_text));
@ -449,8 +453,6 @@ C0bdoCx44QVU8HaZ2x91h3GoM/0q5bqM/rvCauwbokiJgAUrznecNPY=
g_assert_cmpuint(n, ==, 1); g_assert_cmpuint(n, ==, 1);
} }
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {

View File

@ -1076,8 +1076,8 @@ Server::Private::maybe_mark_as_read(MuMsg* msg, Store::Id docid, bool rename)
} }
bool 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) if (!msgid)
return false; // nothing to do. return false; // nothing to do.
@ -1095,6 +1095,9 @@ Server::Private::maybe_mark_msgid_as_read(const char* msgid, bool rename)
} }
return true; return true;
} catch (...) { /* not fatal */
g_warning("failed to mark <%s> as read", msgid);
return false;
} }
void void