Increase maximum message size / number of links

pull/161/head
M66B 5 years ago
parent c2e0cc3cc7
commit cc591baa38

@ -76,8 +76,8 @@ import static androidx.core.text.HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE;
public class HtmlHelper { public class HtmlHelper {
static final int PREVIEW_SIZE = 250; // characters static final int PREVIEW_SIZE = 250; // characters
private static final int MAX_LINKS = 50; private static final int MAX_SIZE = 100 * 1024; // characters
private static final int MAX_SIZE = 50 * 1024; // characters private static final int MAX_LINKS = 500;
private static final int TRACKING_PIXEL_SURFACE = 25; // pixels private static final int TRACKING_PIXEL_SURFACE = 25; // pixels
private static final List<String> heads = Collections.unmodifiableList(Arrays.asList( private static final List<String> heads = Collections.unmodifiableList(Arrays.asList(
@ -126,9 +126,12 @@ public class HtmlHelper {
} }
} }
int size = parsed.text().length();
int links = parsed.select("a").size(); int links = parsed.select("a").size();
if (links > MAX_LINKS || parsed.text().length() > MAX_SIZE) if (size > MAX_SIZE || links > MAX_LINKS) {
Log.i("Message size=" + size + " links=" + links);
return "<strong>" + context.getString(R.string.title_hint_too_complex) + "</strong>"; return "<strong>" + context.getString(R.string.title_hint_too_complex) + "</strong>";
}
Whitelist whitelist = Whitelist.relaxed() Whitelist whitelist = Whitelist.relaxed()
.addTags("hr", "abbr") .addTags("hr", "abbr")

Loading…
Cancel
Save