From 6247d625310192a09a4178b7312f8b95a028f1d9 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 13 Oct 2020 17:24:39 +0200 Subject: [PATCH] Truncate preview texts --- app/src/main/java/eu/faircode/email/Core.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 3c858ea7f5..3103deaddd 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -145,6 +145,7 @@ class Core { private static final int LOCAL_RETRY_MAX = 2; private static final long LOCAL_RETRY_DELAY = 5 * 1000L; // milliseconds private static final int TOTAL_RETRY_MAX = LOCAL_RETRY_MAX * 5; + private static final int MAX_PREVIEW = 5000; // characters static void processOperations( Context context, @@ -3952,6 +3953,8 @@ class Core { try { File file = message.getFile(context); preview = HtmlHelper.getFullText(file); + if (preview != null && preview.length() > MAX_PREVIEW) + preview = preview.substring(0, MAX_PREVIEW); } catch (Throwable ex) { Log.e(ex); }