mirror of https://github.com/M66B/FairEmail.git
Remove NUL characters from received messages
This commit is contained in:
parent
087a98359c
commit
4929bf2429
|
@ -776,12 +776,17 @@ public class MessageHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
String result;
|
String result;
|
||||||
boolean text = false;
|
|
||||||
Part part = (html == null ? plain : html);
|
Part part = (html == null ? plain : html);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object content = part.getContent();
|
Object content = part.getContent();
|
||||||
Log.i("Content class=" + (content == null ? null : content.getClass().getName()));
|
Log.i("Content class=" + (content == null ? null : content.getClass().getName()));
|
||||||
|
|
||||||
|
if (content == null) {
|
||||||
|
warnings.add(context.getString(R.string.title_no_body));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (content instanceof String)
|
if (content instanceof String)
|
||||||
result = (String) content;
|
result = (String) content;
|
||||||
else if (content instanceof InputStream)
|
else if (content instanceof InputStream)
|
||||||
|
@ -818,7 +823,9 @@ public class MessageHelper {
|
||||||
warnings.add(Helper.formatThrowable(ex));
|
warnings.add(Helper.formatThrowable(ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part.isMimeType("text/plain") || text) {
|
result = result.replace("\0", "");
|
||||||
|
|
||||||
|
if (part.isMimeType("text/plain")) {
|
||||||
result = TextUtils.htmlEncode(result);
|
result = TextUtils.htmlEncode(result);
|
||||||
result = result.replaceAll("\\r?\\n", "<br />");
|
result = result.replaceAll("\\r?\\n", "<br />");
|
||||||
result = "<span>" + result + "</span>";
|
result = "<span>" + result + "</span>";
|
||||||
|
|
Loading…
Reference in New Issue