Support subscribe links that have a slash before the argument
This commit is contained in:
parent
31c0f90d07
commit
b1eda19a73
|
@ -29,7 +29,7 @@ public final class URLChecker {
|
|||
private static final String TAG = "URLChecker";
|
||||
|
||||
private static final String AP_SUBSCRIBE = "antennapod-subscribe://";
|
||||
private static final String AP_SUBSCRIBE_DEEPLINK = "antennapod.org/deeplink/subscribe?url=";
|
||||
private static final String AP_SUBSCRIBE_DEEPLINK = "antennapod.org/deeplink/subscribe";
|
||||
|
||||
/**
|
||||
* Checks if URL is valid and modifies it if necessary.
|
||||
|
@ -57,7 +57,7 @@ public final class URLChecker {
|
|||
return prepareURL(url.substring(AP_SUBSCRIBE.length()));
|
||||
} else if (lowerCaseUrl.contains(AP_SUBSCRIBE_DEEPLINK)) {
|
||||
Log.d(TAG, "Removing " + AP_SUBSCRIBE_DEEPLINK);
|
||||
String removedWebsite = url.substring(url.indexOf(AP_SUBSCRIBE_DEEPLINK) + AP_SUBSCRIBE_DEEPLINK.length());
|
||||
String removedWebsite = url.substring(url.indexOf("?url=") + "?url=".length());
|
||||
try {
|
||||
return prepareURL(URLDecoder.decode(removedWebsite, "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
|
|
@ -106,8 +106,10 @@ public class URLCheckerTest {
|
|||
final String feed = "http://example.org/podcast.rss";
|
||||
assertEquals(feed, URLChecker.prepareURL("https://antennapod.org/deeplink/subscribe?url=" + feed));
|
||||
assertEquals(feed, URLChecker.prepareURL("http://antennapod.org/deeplink/subscribe?url=" + feed));
|
||||
assertEquals(feed, URLChecker.prepareURL("http://antennapod.org/deeplink/subscribe/?url=" + feed));
|
||||
assertEquals(feed, URLChecker.prepareURL("https://www.antennapod.org/deeplink/subscribe?url=" + feed));
|
||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe?url=" + feed));
|
||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe/?url=" + feed));
|
||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe?url="
|
||||
+ URLEncoder.encode(feed, "UTF-8")));
|
||||
assertEquals(feed, URLChecker.prepareURL("http://www.antennapod.org/deeplink/subscribe?url="
|
||||
|
|
Loading…
Reference in New Issue