mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 09:03:56 +02:00
Fixed images in signatures/templates
This commit is contained in:
@@ -290,8 +290,7 @@ public class ActivitySignature extends ActivityBase {
|
||||
else if (etText.isRaw())
|
||||
etText.setText(html);
|
||||
else {
|
||||
Document d = JsoupEx.parse(html);
|
||||
d = HtmlHelper.sanitizeView(this, d, true);
|
||||
Document d = HtmlHelper.sanitizeCompose(this, html, true);
|
||||
Spanned signature = HtmlHelper.fromDocument(this, d, new HtmlHelper.ImageGetterEx() {
|
||||
@Override
|
||||
public Drawable getDrawable(Element element) {
|
||||
|
||||
@@ -229,8 +229,7 @@ public class FragmentAnswer extends FragmentBase {
|
||||
|
||||
String html = (answer == null ? args.getString("html") : answer.text);
|
||||
if (html != null) {
|
||||
Document d = JsoupEx.parse(html);
|
||||
d = HtmlHelper.sanitizeView(context, d, true);
|
||||
Document d = HtmlHelper.sanitizeCompose(context, html, true);
|
||||
Spanned spanned = HtmlHelper.fromDocument(context, d, new HtmlHelper.ImageGetterEx() {
|
||||
@Override
|
||||
public Drawable getDrawable(Element element) {
|
||||
|
||||
@@ -2437,8 +2437,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
String html = EntityAnswer.replacePlaceholders(context, answer.text, tos);
|
||||
|
||||
Document d = JsoupEx.parse(html);
|
||||
d = HtmlHelper.sanitizeView(context, d, true);
|
||||
Document d = HtmlHelper.sanitizeCompose(context, html, true);
|
||||
Spanned spanned = HtmlHelper.fromDocument(context, d, new HtmlHelper.ImageGetterEx() {
|
||||
@Override
|
||||
public Drawable getDrawable(Element element) {
|
||||
@@ -3393,8 +3392,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
Helper.writeText(file, doc.html());
|
||||
}
|
||||
|
||||
Document d = JsoupEx.parse(html);
|
||||
d = HtmlHelper.sanitizeView(context, d, true);
|
||||
Document d = HtmlHelper.sanitizeCompose(context, html, true);
|
||||
return HtmlHelper.fromDocument(context, d, new HtmlHelper.ImageGetterEx() {
|
||||
@Override
|
||||
public Drawable getDrawable(Element element) {
|
||||
@@ -7302,8 +7300,7 @@ public class FragmentCompose extends FragmentBase {
|
||||
|
||||
Spanned signature = null;
|
||||
if (identity != null && !TextUtils.isEmpty(identity.signature)) {
|
||||
Document d = JsoupEx.parse(identity.signature);
|
||||
d = HtmlHelper.sanitizeView(getContext(), d, show_images);
|
||||
Document d = HtmlHelper.sanitizeCompose(getContext(), identity.signature, show_images);
|
||||
signature = HtmlHelper.fromDocument(getContext(), d, new HtmlHelper.ImageGetterEx() {
|
||||
@Override
|
||||
public Drawable getDrawable(Element element) {
|
||||
|
||||
@@ -415,8 +415,12 @@ public class HtmlHelper {
|
||||
}
|
||||
|
||||
static Document sanitizeCompose(Context context, String html, boolean show_images) {
|
||||
return sanitizeCompose(context, JsoupEx.parse(html), show_images);
|
||||
}
|
||||
|
||||
static Document sanitizeCompose(Context context, Document parsed, boolean show_images) {
|
||||
try {
|
||||
return sanitize(context, JsoupEx.parse(html), false, show_images);
|
||||
return sanitize(context, parsed, false, show_images);
|
||||
} catch (Throwable ex) {
|
||||
// OutOfMemoryError
|
||||
Log.e(ex);
|
||||
|
||||
Reference in New Issue
Block a user