From 8fa6941d45491e0d0e5f8e1e25b5bf98ff40d6a3 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 24 May 2021 07:45:57 +0200 Subject: [PATCH] Exclude rel elements for favicons --- app/src/main/java/eu/faircode/email/ContactInfo.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index f1259dc940..2ff73005fa 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -111,6 +111,10 @@ public class ContactInfo { private static final long CACHE_GRAVATAR_DURATION = 2 * 60 * 60 * 1000L; // milliseconds private static final long CACHE_FAVICON_DURATION = 2 * 7 * 24 * 60 * 60 * 1000L; // milliseconds + private static final List REL_EXCLUDE = Collections.unmodifiableList(Arrays.asList( + "dns-prefetch", "preconnect", "prefetch", "preload", "prerender" + )); + private ContactInfo() { } @@ -551,7 +555,8 @@ public class ContactInfo { List> futures = new ArrayList<>(); for (Element img : imgs) { // https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch - if ("dns-prefetch".equals(img.attr("rel"))) // gmx.net + String rel = img.attr("rel").trim().toLowerCase(Locale.ROOT); + if (REL_EXCLUDE.contains(rel)) // dns-prefetch: gmx.net continue; String favicon = ("link".equals(img.tagName())