From 7b183675c3868f992115f3e789f91644c4742be4 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 23 Sep 2019 19:51:26 +0200 Subject: [PATCH] Sanitize (external) drafts --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 73e849da50..73b09090f9 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2368,7 +2368,12 @@ public class FragmentCompose extends FragmentBase { EntityOperation.queue(context, data.draft, EntityOperation.ADD); } else { - if (!data.draft.content) { + if (data.draft.content) { + File file = data.draft.getFile(context); + String html = Helper.readText(file); + html = HtmlHelper.sanitize(context, html, true); + Helper.writeText(file, html); + } else { if (data.draft.uid == null) throw new IllegalStateException("Draft without uid"); EntityOperation.queue(context, data.draft, EntityOperation.BODY);