From 273f3777898602564543f7e2cdc210798ecb43b1 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 4 Jun 2019 17:04:01 +0200 Subject: [PATCH] Fixed parsing List-Post header --- .../java/eu/faircode/email/MessageHelper.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 0afa1eb2ce..b8fcbe7eee 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -599,19 +599,19 @@ public class MessageHelper { return null; list = MimeUtility.unfold(list); - if ("NO".equals(list) || !list.startsWith("<") || !list.endsWith(">")) + if ("NO".equals(list)) + return null; + + String[] to = list.split(","); + if (to.length < 1 || !to[0].startsWith("<") || !to[0].endsWith(">")) return null; // https://www.ietf.org/rfc/rfc2368.txt - try { - MailTo to = MailTo.parse(list.substring(1, list.length() - 1)); - if (to.getTo() == null) - return null; + MailTo mailto = MailTo.parse(to[0].substring(1, to[0].length() - 1)); + if (mailto.getTo() == null) + return null; - return new Address[]{new InternetAddress(to.getTo().split(",")[0])}; - } catch (android.net.ParseException ex) { - throw new IllegalArgumentException(list, ex); - } + return new Address[]{new InternetAddress(mailto.getTo().split(",")[0])}; } catch (android.net.ParseException ex) { Log.w(ex); return null;