mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 00:53:26 +02:00
Jsoup parse from file to reduce memory usage
This commit is contained in:
@@ -1690,18 +1690,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
if (!file.exists())
|
||||
return null;
|
||||
|
||||
String body = Helper.readText(file);
|
||||
if (!TextUtils.isEmpty(body))
|
||||
if (file.length() > 0)
|
||||
signed_data = false;
|
||||
args.putBoolean("signed_data", signed_data);
|
||||
|
||||
Document document = JsoupEx.parse(body);
|
||||
Document document = JsoupEx.parse(file);
|
||||
HtmlHelper.cleanup(document);
|
||||
|
||||
// Check for inline encryption
|
||||
int begin = body.indexOf(Helper.PGP_BEGIN_MESSAGE);
|
||||
int end = body.indexOf(Helper.PGP_END_MESSAGE);
|
||||
args.putBoolean("inline_encrypted", begin >= 0 && begin < end);
|
||||
boolean iencrypted = HtmlHelper.contains(document, new String[]{
|
||||
Helper.PGP_BEGIN_MESSAGE,
|
||||
Helper.PGP_END_MESSAGE
|
||||
});
|
||||
args.putBoolean("inline_encrypted", iencrypted);
|
||||
|
||||
// Check for images
|
||||
boolean has_images = false;
|
||||
@@ -1752,7 +1753,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
HtmlHelper.removeTrackingPixels(context, document);
|
||||
|
||||
if (debug) {
|
||||
Document format = JsoupEx.parse(document.html());
|
||||
Document format = JsoupEx.parse(file);
|
||||
format.outputSettings().prettyPrint(true).outline(true).indentAmount(1);
|
||||
Element pre = document.createElement("pre");
|
||||
pre.text(format.html());
|
||||
|
||||
Reference in New Issue
Block a user