This commit is contained in:
Athou
2013-05-17 14:33:21 +02:00
parent 0478c4f273
commit 11632286bf
2 changed files with 10 additions and 5 deletions

View File

@@ -24,8 +24,9 @@ public class FeedUtils {
return encoding;
}
public static String handleContent(String content) {
public static String handleContent(String content, String baseUri) {
if (StringUtils.isNotBlank(content)) {
baseUri = StringUtils.trimToEmpty(baseUri);
Whitelist whitelist = Whitelist.relaxed();
whitelist.addEnforcedAttribute("a", "target", "_blank");
@@ -33,8 +34,9 @@ public class FeedUtils {
whitelist.addAttributes("iframe", "src", "height", "width",
"allowfullscreen", "frameborder");
content = Jsoup.clean(content, "", whitelist,
new OutputSettings().escapeMode(EscapeMode.base));
content = Jsoup.clean(content, baseUri, whitelist,
new OutputSettings().escapeMode(EscapeMode.base)
.prettyPrint(false));
}
return content;
}