1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Prevent extra newline at end

This commit is contained in:
M66B 2020-08-03 22:52:46 +02:00
parent 8c1866f266
commit 263c10f594

View file

@ -289,6 +289,12 @@ public class HtmlHelper {
static Document sanitizeCompose(Context context, String html, boolean show_images) { static Document sanitizeCompose(Context context, String html, boolean show_images) {
try { try {
Document parsed = JsoupEx.parse(html); Document parsed = JsoupEx.parse(html);
// Prevent extra newline at end
Element body = parsed.body();
if (body != null && body.childrenSize() == 1 && "p".equals(body.child(0).tagName()))
body.child(0).tagName("span").appendChild(new Element("br"));
return sanitize(context, parsed, false, show_images); return sanitize(context, parsed, false, show_images);
} catch (Throwable ex) { } catch (Throwable ex) {
// OutOfMemoryError // OutOfMemoryError