Truncate long alt texts

pull/178/head
M66B 5 years ago
parent e84f9b0f09
commit 268be8761b

@ -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 + "]");

Loading…
Cancel
Save