mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-30 17:40:34 +01:00
Check all img parents for anchor
This commit is contained in:
@@ -40,8 +40,14 @@ public class HtmlHelper {
|
||||
for (Element tr : document.select("tr"))
|
||||
tr.after("<br>");
|
||||
|
||||
for (Element img : document.select("img"))
|
||||
if (img.hasParent() && !"a".equals(img.parent().tagName())) {
|
||||
for (Element img : document.select("img")) {
|
||||
boolean linked = false;
|
||||
for (Element parent : img.parents())
|
||||
if ("a".equals(parent.tagName())) {
|
||||
linked = true;
|
||||
break;
|
||||
}
|
||||
if (!linked) {
|
||||
String src = img.attr("src");
|
||||
if (src.startsWith("http://") || src.startsWith("https://")) {
|
||||
Element a = document.createElement("a");
|
||||
@@ -50,6 +56,7 @@ public class HtmlHelper {
|
||||
a.appendChild(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NodeTraversor.traverse(new NodeVisitor() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user