Accept more malformed subscribtion URIs
This commit is contained in:
parent
6079990643
commit
9d23279f47
@ -56,6 +56,13 @@ public class URLCheckerTest {
|
|||||||
assertEquals("http://example.com", out);
|
assertEquals("http://example.com", out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testItpcProtocolWithScheme() {
|
||||||
|
final String in = "itpc://https://example.com";
|
||||||
|
final String out = URLChecker.prepareURL(in);
|
||||||
|
assertEquals("https://example.com", out);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWhiteSpaceUrlShouldNotAppend() {
|
public void testWhiteSpaceUrlShouldNotAppend() {
|
||||||
final String in = "\n http://example.com \t";
|
final String in = "\n http://example.com \t";
|
||||||
|
@ -41,7 +41,7 @@ public final class URLChecker {
|
|||||||
String lowerCaseUrl = url.toLowerCase(); // protocol names are case insensitive
|
String lowerCaseUrl = url.toLowerCase(); // protocol names are case insensitive
|
||||||
if (lowerCaseUrl.startsWith("feed://")) {
|
if (lowerCaseUrl.startsWith("feed://")) {
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, "Replacing feed:// with http://");
|
if (BuildConfig.DEBUG) Log.d(TAG, "Replacing feed:// with http://");
|
||||||
return url.replaceFirst("feed://", "http://");
|
return prepareURL(url.substring("feed://".length()));
|
||||||
} else if (lowerCaseUrl.startsWith("pcast://")) {
|
} else if (lowerCaseUrl.startsWith("pcast://")) {
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, "Removing pcast://");
|
if (BuildConfig.DEBUG) Log.d(TAG, "Removing pcast://");
|
||||||
return prepareURL(url.substring("pcast://".length()));
|
return prepareURL(url.substring("pcast://".length()));
|
||||||
@ -50,7 +50,7 @@ public final class URLChecker {
|
|||||||
return prepareURL(url.substring("pcast:".length()));
|
return prepareURL(url.substring("pcast:".length()));
|
||||||
} else if (lowerCaseUrl.startsWith("itpc")) {
|
} else if (lowerCaseUrl.startsWith("itpc")) {
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, "Replacing itpc:// with http://");
|
if (BuildConfig.DEBUG) Log.d(TAG, "Replacing itpc:// with http://");
|
||||||
return url.replaceFirst("itpc://", "http://");
|
return prepareURL(url.substring("itpc://".length()));
|
||||||
} else if (lowerCaseUrl.startsWith(AP_SUBSCRIBE)) {
|
} else if (lowerCaseUrl.startsWith(AP_SUBSCRIBE)) {
|
||||||
if (BuildConfig.DEBUG) Log.d(TAG, "Removing antennapod-subscribe://");
|
if (BuildConfig.DEBUG) Log.d(TAG, "Removing antennapod-subscribe://");
|
||||||
return prepareURL(url.substring(AP_SUBSCRIBE.length()));
|
return prepareURL(url.substring(AP_SUBSCRIBE.length()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user