From 7b621bd9ef9fa19df705880dc14f105a7df26ddf Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 4 Jun 2023 17:12:50 +0200 Subject: [PATCH] Improved needs headers check --- app/src/main/java/eu/faircode/email/EntityRule.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index 6ead7e556d..2d1007c905 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -150,8 +150,16 @@ public class EntityRule { for (EntityRule rule : rules) try { JSONObject jcondition = new JSONObject(rule.condition); - if (jcondition.has(what)) + if (jcondition.has(what)) { + if ("header".equals(what)) { + JSONObject jheader = jcondition.getJSONObject("header"); + String value = jheader.getString("value"); + boolean regex = jheader.getBoolean("regex"); + if (!regex && value.startsWith("$$") && value.endsWith("$")) + continue; + } return true; + } } catch (Throwable ex) { Log.e(ex); } @@ -319,7 +327,6 @@ public class EntityRule { boolean regex = jheader.getBoolean("regex"); if (!regex && - value != null && value.startsWith("$") && value.endsWith("$")) { String keyword = value.substring(1, value.length() - 1);