diff --git a/k9mail/build.gradle b/k9mail/build.gradle index 21b8ba388..06301c99d 100644 --- a/k9mail/build.gradle +++ b/k9mail/build.gradle @@ -28,7 +28,7 @@ dependencies { compile "com.squareup.okio:okio:${okioVersion}" compile 'commons-io:commons-io:2.4' compile "com.android.support:support-v4:${androidSupportLibraryVersion}" - compile 'org.jsoup:jsoup:1.10.2' + compile 'org.jsoup:jsoup:1.11.2' compile 'de.cketti.library.changelog:ckchangelog:1.2.1' compile 'com.github.bumptech.glide:glide:3.6.1' compile 'com.splitwise:tokenautocomplete:2.0.7' diff --git a/k9mail/src/main/java/com/fsck/k9/message/html/HtmlSanitizer.java b/k9mail/src/main/java/com/fsck/k9/message/html/HtmlSanitizer.java index ae2d81c45..63e9eaedb 100644 --- a/k9mail/src/main/java/com/fsck/k9/message/html/HtmlSanitizer.java +++ b/k9mail/src/main/java/com/fsck/k9/message/html/HtmlSanitizer.java @@ -13,7 +13,7 @@ public class HtmlSanitizer { HtmlSanitizer() { Whitelist whitelist = Whitelist.relaxed() - .addTags("font", "hr", "ins", "del") + .addTags("font", "hr", "ins", "del", "center") .addAttributes("font", "color", "face", "size") .addAttributes("table", "align", "background", "bgcolor", "border", "cellpadding", "cellspacing", "width") diff --git a/k9mail/src/test/java/com/fsck/k9/message/html/HtmlSanitizerTest.java b/k9mail/src/test/java/com/fsck/k9/message/html/HtmlSanitizerTest.java index b0d9ab9e1..38d8d6e4f 100644 --- a/k9mail/src/test/java/com/fsck/k9/message/html/HtmlSanitizerTest.java +++ b/k9mail/src/test/java/com/fsck/k9/message/html/HtmlSanitizerTest.java @@ -189,4 +189,28 @@ public class HtmlSanitizerTest { assertEquals("
", toCompactString(result)); } + + @Test + public void shouldRemoveIFrames() { + String html = "" + + "" + + ""; + + Document result = htmlSanitizer.sanitize(html); + + assertEquals("", toCompactString(result)); + } + + @Test + public void shouldKeepFormattingTags() { + String html = "" + + "