diff options
author | ByteHamster <info@bytehamster.com> | 2021-10-31 11:21:28 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-10-31 11:21:28 +0100 |
commit | b1eda19a732736db755693943c5351f71716af73 (patch) | |
tree | 606990739ddfb85f5893c78a4562f9b013f07015 /core/src | |
parent | 31c0f90d0720518705da6a86b2541c2b38b054b8 (diff) | |
download | AntennaPod-b1eda19a732736db755693943c5351f71716af73.zip |
Support subscribe links that have a slash before the argument
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java | 4 | ||||
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/util/URLCheckerTest.java | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java b/core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java index 1ac068307..a72d2034b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/URLChecker.java @@ -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) { diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/URLCheckerTest.java b/core/src/test/java/de/danoeh/antennapod/core/util/URLCheckerTest.java index c20398ffc..25db2e1c4 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/URLCheckerTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/util/URLCheckerTest.java @@ -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=" |