forked from Archives/Athou_commafeed
don't check the query params for feedburner
This commit is contained in:
@@ -43,6 +43,7 @@ public class FeedUtils {
|
|||||||
|
|
||||||
protected static Logger log = LoggerFactory.getLogger(FeedUtils.class);
|
protected static Logger log = LoggerFactory.getLogger(FeedUtils.class);
|
||||||
|
|
||||||
|
private static final String ESCAPED_QUESTION_MARK = Pattern.quote("?");
|
||||||
private static final List<String> ALLOWED_IFRAME_CSS_RULES = Arrays.asList(
|
private static final List<String> ALLOWED_IFRAME_CSS_RULES = Arrays.asList(
|
||||||
"height", "width", "border");
|
"height", "width", "border");
|
||||||
private static final char[] DISALLOWED_IFRAME_CSS_RULE_CHARACTERS = new char[] {
|
private static final char[] DISALLOWED_IFRAME_CSS_RULE_CHARACTERS = new char[] {
|
||||||
@@ -119,10 +120,10 @@ public class FeedUtils {
|
|||||||
"feeds.feedburner.com");
|
"feeds.feedburner.com");
|
||||||
|
|
||||||
// feedburner feeds have a special treatment
|
// feedburner feeds have a special treatment
|
||||||
if (normalized.contains("feedburner.com")) {
|
if (normalized.split(ESCAPED_QUESTION_MARK)[0].contains("feedburner.com")) {
|
||||||
normalized = normalized.replace("feeds2.feedburner.com",
|
normalized = normalized.replace("feeds2.feedburner.com",
|
||||||
"feeds.feedburner.com");
|
"feeds.feedburner.com");
|
||||||
normalized = normalized.split(Pattern.quote("?"))[0];
|
normalized = normalized.split(ESCAPED_QUESTION_MARK)[0];
|
||||||
normalized = StringUtils.removeEnd(normalized, "/");
|
normalized = StringUtils.removeEnd(normalized, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ public class FeedUtilsTest {
|
|||||||
String urlc3 = "http://feedproxy.google.com/frandroid";
|
String urlc3 = "http://feedproxy.google.com/frandroid";
|
||||||
String urlc4 = "http://feeds.feedburner.com/Frandroid/";
|
String urlc4 = "http://feeds.feedburner.com/Frandroid/";
|
||||||
String urlc5 = "http://feeds.feedburner.com/Frandroid?format=rss";
|
String urlc5 = "http://feeds.feedburner.com/Frandroid?format=rss";
|
||||||
|
|
||||||
|
|
||||||
|
String urld1 = "http://fivefilters.org/content-only/makefulltextfeed.php?url=http://feeds.feedburner.com/Frandroid";
|
||||||
|
String urld2 = "http://fivefilters.org/content-only/makefulltextfeed.php?url=http://feeds2.feedburner.com/Frandroid";
|
||||||
|
|
||||||
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla2));
|
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla2));
|
||||||
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla3));
|
Assert.assertEquals(FeedUtils.normalizeURL(urla1), FeedUtils.normalizeURL(urla3));
|
||||||
@@ -33,6 +37,8 @@ public class FeedUtilsTest {
|
|||||||
Assert.assertEquals(FeedUtils.normalizeURL(urlc1), FeedUtils.normalizeURL(urlc3));
|
Assert.assertEquals(FeedUtils.normalizeURL(urlc1), FeedUtils.normalizeURL(urlc3));
|
||||||
Assert.assertEquals(FeedUtils.normalizeURL(urlc1), FeedUtils.normalizeURL(urlc4));
|
Assert.assertEquals(FeedUtils.normalizeURL(urlc1), FeedUtils.normalizeURL(urlc4));
|
||||||
Assert.assertEquals(FeedUtils.normalizeURL(urlc1), FeedUtils.normalizeURL(urlc5));
|
Assert.assertEquals(FeedUtils.normalizeURL(urlc1), FeedUtils.normalizeURL(urlc5));
|
||||||
|
|
||||||
|
Assert.assertNotEquals(FeedUtils.normalizeURL(urld1), FeedUtils.normalizeURL(urld2));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user