[geary/mjog/rfc822-cleanup-part-deux: 3/8] Geary.RFC822.Message: Suppress message id errors in ctors
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/rfc822-cleanup-part-deux: 3/8] Geary.RFC822.Message: Suppress message id errors in ctors
- Date: Tue, 30 Jun 2020 04:49:51 +0000 (UTC)
commit a75c62ebbe24c491a495c663f30d8da3e9d4eef3
Author: Michael Gratton <mike vee net>
Date: Tue Jun 30 14:26:31 2020 +1000
Geary.RFC822.Message: Suppress message id errors in ctors
Even if the a message has an invalid message id or message id list
header value, we need to keep parsing the message to ensure we can
do *something* useful with it.
src/engine/rfc822/rfc822-message.vala | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822-message.vala b/src/engine/rfc822/rfc822-message.vala
index 476a3b408..0a98a698a 100644
--- a/src/engine/rfc822/rfc822-message.vala
+++ b/src/engine/rfc822/rfc822-message.vala
@@ -961,11 +961,21 @@ public class Geary.RFC822.Message : BaseObject, EmailHeaderSet {
return addresses;
}
- private MessageIDList append_message_id(MessageIDList? existing,
- string header_value) {
- MessageIDList ids = new MessageIDList.from_rfc822_string(header_value);
- if (existing != null) {
- ids = existing.append(ids);
+ private MessageIDList? append_message_id(MessageIDList? existing,
+ string header_value)
+ throws Error {
+ MessageIDList? ids = existing;
+ if (!String.is_empty_or_whitespace(header_value)) {
+ try {
+ ids = new MessageIDList.from_rfc822_string(header_value);
+ if (existing != null) {
+ ids = existing.append(ids);
+ }
+ } catch (Error err) {
+ // Can't simply throw this since we need to be as lax as
+ // possible when decoding messages. Hence just log it.
+ debug("Error parsing message id list: %s", err.message);
+ }
}
return ids;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]