Truncate long alt texts

This commit is contained in:
M66B 2020-05-04 20:19:05 +02:00
parent e84f9b0f09
commit 268be8761b
1 changed files with 4 additions and 0 deletions

View File

@ -125,6 +125,7 @@ public class HtmlHelper {
private static final float FONT_LARGE = 1.25f;
private static final float MIN_LUMINANCE = 0.5f;
private static final int TAB_SIZE = 2;
private static final int MAX_ALT = 250;
private static final int MAX_AUTO_LINK = 250;
private static final int MAX_FORMAT_TEXT_SIZE = 50 * 1024; // characters
private static final int MAX_FULL_TEXT_SIZE = 1024 * 1024; // characters
@ -820,6 +821,9 @@ public class HtmlHelper {
String src = img.attr("src");
String tracking = img.attr("tracking");
if (alt.length() > MAX_ALT)
alt = alt.substring(0, MAX_ALT) + "";
if (!show_images && !TextUtils.isEmpty(alt))
if (TextUtils.isEmpty(tracking))
img.appendText("[" + alt + "]");