Merge pull request #5513 from ByteHamster/subscribe-link
Support subscribe links that have a slash before the argument
This commit is contained in:
commit
d9bf519708
|
@ -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