diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index f84d1da5ef..0abded5fc2 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -78,7 +78,7 @@ import static androidx.core.text.HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE; public class HtmlHelper { static final int PREVIEW_SIZE = 250; // characters - private static final int MAX_LINKS = 500; + private static final int MAX_AUTO_LINK = 250; private static final int TRACKING_PIXEL_SURFACE = 25; // pixels private static final List heads = Collections.unmodifiableList(Arrays.asList( @@ -127,12 +127,6 @@ public class HtmlHelper { } } - int links = parsed.select("a").size(); - if (links > MAX_LINKS) { - Log.i("Message links=" + links); - return "" + context.getString(R.string.title_hint_too_complex) + ""; - } - Whitelist whitelist = Whitelist.relaxed() .addTags("hr", "abbr") .removeTags("col", "colgroup", "thead", "tbody") @@ -275,11 +269,11 @@ public class HtmlHelper { PatternsCompat.AUTOLINK_WEB_URL.pattern()); NodeTraversor.traverse(new NodeVisitor() { - private int alinks = links; + private int links = 0; @Override public void head(Node node, int depth) { - if (alinks < MAX_LINKS && node instanceof TextNode) { + if (links < MAX_AUTO_LINK && node instanceof TextNode) { TextNode tnode = (TextNode) node; String text = tnode.text(); @@ -303,7 +297,7 @@ public class HtmlHelper { if (BuildConfig.DEBUG) Log.i("Web url=" + matcher.group() + " " + matcher.start() + "..." + matcher.end() + "/" + text.length() + - " linked=" + linked + " email=" + email); + " linked=" + linked + " email=" + email + " count=" + links); if (linked) span.appendText(text.substring(pos, matcher.end())); @@ -315,11 +309,11 @@ public class HtmlHelper { a.text(matcher.group()); span.appendChild(a); - alinks++; + links++; } pos = matcher.end(); - } while (alinks < MAX_LINKS && matcher.find()); + } while (links < MAX_AUTO_LINK && matcher.find()); span.appendText(text.substring(pos)); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e734a5462f..142bd2e091 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -763,7 +763,6 @@ Long press a message to start selecting multiple messages Downloading messages can take some time, depending on the speed of the provider, internet connection and device and on the number of messages. While downloading messages the app might respond slower. Image link - Message too large or too complex to display Tracking image %1$sx%2$s Long press for options