mirror of https://github.com/M66B/FairEmail.git
Prevent crash
This commit is contained in:
parent
5529099ade
commit
6695a0c26b
|
@ -130,16 +130,19 @@ public class HtmlHelper {
|
||||||
String ns = null;
|
String ns = null;
|
||||||
for (Element h : parsed.select("html"))
|
for (Element h : parsed.select("html"))
|
||||||
for (Attribute a : h.attributes()) {
|
for (Attribute a : h.attributes()) {
|
||||||
if (a.getKey().startsWith("xmlns:") &&
|
String key = a.getKey();
|
||||||
a.getValue().startsWith("http://www.w3.org/")) {
|
String value = a.getValue();
|
||||||
ns = a.getKey().split(":")[1];
|
if (value != null &&
|
||||||
|
key.startsWith("xmlns:") &&
|
||||||
|
value.startsWith("http://www.w3.org/")) {
|
||||||
|
ns = key.split(":")[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Element e : parsed.select("*"))
|
for (Element e : parsed.select("*")) {
|
||||||
if (e.tagName().contains(":")) {
|
String tag = e.tagName();
|
||||||
String tag = e.tagName();
|
if (tag.contains(":")) {
|
||||||
if (ns != null && e.tagName().startsWith(ns)) {
|
if (ns != null && tag.startsWith(ns)) {
|
||||||
e.tagName(tag.split(":")[1]);
|
e.tagName(tag.split(":")[1]);
|
||||||
Log.i("Updated tag=" + tag + " to=" + e.tagName());
|
Log.i("Updated tag=" + tag + " to=" + e.tagName());
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,6 +150,7 @@ public class HtmlHelper {
|
||||||
Log.i("Removed tag=" + tag);
|
Log.i("Removed tag=" + tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Whitelist whitelist = Whitelist.relaxed()
|
Whitelist whitelist = Whitelist.relaxed()
|
||||||
.addTags("hr", "abbr")
|
.addTags("hr", "abbr")
|
||||||
|
|
Loading…
Reference in New Issue