Fixed hiding image placeholders

pull/189/head
M66B 5 years ago
parent 38343a8290
commit 75bbc2ec03

@ -952,6 +952,7 @@ public class HtmlHelper {
String alt = img.attr("alt"); String alt = img.attr("alt");
String src = img.attr("src"); String src = img.attr("src");
String tracking = img.attr("x-tracking"); String tracking = img.attr("x-tracking");
boolean isInline = src.startsWith("cid:");
if (TextUtils.isEmpty(src)) { if (TextUtils.isEmpty(src)) {
Log.i("Removing empty image"); Log.i("Removing empty image");
@ -959,14 +960,14 @@ public class HtmlHelper {
continue; continue;
} }
if (!show_images && !inline_images && !image_placeholders) { if (!show_images && !(inline_images && isInline) && !image_placeholders) {
Log.i("Removing placeholder"); Log.i("Removing placeholder");
img.removeAttr("src"); img.removeAttr("src");
continue; continue;
} }
// Remove spacer, etc // Remove spacer, etc
if (!show_images && !inline_images && if (!show_images && !(inline_images && isInline) &&
TextUtils.isEmpty(img.attr("x-tracking"))) { TextUtils.isEmpty(img.attr("x-tracking"))) {
Log.i("Removing small image"); Log.i("Removing small image");
Integer width = Helper.parseInt(img.attr("width").trim()); Integer width = Helper.parseInt(img.attr("width").trim());
@ -981,7 +982,7 @@ public class HtmlHelper {
if (alt.length() > MAX_ALT) if (alt.length() > MAX_ALT)
alt = alt.substring(0, MAX_ALT) + "…"; alt = alt.substring(0, MAX_ALT) + "…";
if (!show_images && !(inline_images && src.startsWith("cid:")) && !TextUtils.isEmpty(alt)) if (!show_images && !(inline_images && isInline) && !TextUtils.isEmpty(alt))
if (TextUtils.isEmpty(tracking)) if (TextUtils.isEmpty(tracking))
img.appendText("[" + alt + "]"); img.appendText("[" + alt + "]");
else { else {

Loading…
Cancel
Save