From 37981b0ac32da4181beb22d1b910b8667237e585 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 24 Nov 2018 12:27:44 +0100 Subject: [PATCH] Make images link to themselves --- .../main/java/eu/faircode/email/AdapterMessage.java | 2 +- app/src/main/java/eu/faircode/email/HtmlHelper.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 093e0f0f5f..6c9393b25e 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -701,7 +701,7 @@ public class AdapterMessage extends PagedListAdapter"); + + for (Element img : document.select("img")) + if (img.hasParent() && !"a".equals(img.parent().tagName())) { + String src = img.attr("src"); + if (src.startsWith("http://") || src.startsWith("https://")) { + Element a = document.createElement("a"); + a.attr("href", src); + img.replaceWith(a); + a.appendChild(img); + } + } + NodeTraversor.traverse(new NodeVisitor() { @Override public void head(Node node, int depth) {