Properly escape plain text

This commit is contained in:
M66B 2019-05-09 09:25:16 +02:00
parent 114f7276d9
commit e56629689c
1 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@ package eu.faircode.email;
*/
import android.content.Context;
import android.text.Html;
import android.text.TextUtils;
import android.webkit.MimeTypeMap;
@ -809,8 +810,11 @@ public class MessageHelper {
warnings.add(context.getString(R.string.title_no_charset, charset));
}
if (part.isMimeType("text/plain") || text)
result = "<span>" + result.replaceAll("\\r?\\n", "<br />") + "</span>";
if (part.isMimeType("text/plain") || text) {
result = Html.escapeHtml(result);
result = result.replaceAll("\\r?\\n", "<br />");
result = "<span>" + result + "</span>";
}
return result;
}