diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java index 952c4f157..f0fe13cbc 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java @@ -102,15 +102,11 @@ public class OnlineFeedViewActivity extends AppCompatActivity { feedUrl = getIntent().getDataString(); } - if (feedUrl == null) { + if (feedUrl == null || UrlChecker.isDeeplinkWithoutUrl(feedUrl)) { Log.e(TAG, "feedUrl is null."); showNoPodcastFoundError(); } else { Log.d(TAG, "Activity was started with url " + feedUrl); - // Remove subscribeonandroid.com from feed URL in order to subscribe to the actual feed URL - if (feedUrl.contains("subscribeonandroid.com")) { - feedUrl = feedUrl.replaceFirst("((www.)?(subscribeonandroid.com/))", ""); - } if (savedInstanceState != null) { username = savedInstanceState.getString("username"); password = savedInstanceState.getString("password"); diff --git a/net/common/src/main/java/de/danoeh/antennapod/net/common/UrlChecker.java b/net/common/src/main/java/de/danoeh/antennapod/net/common/UrlChecker.java index 79116f00d..c52720bbc 100644 --- a/net/common/src/main/java/de/danoeh/antennapod/net/common/UrlChecker.java +++ b/net/common/src/main/java/de/danoeh/antennapod/net/common/UrlChecker.java @@ -62,6 +62,8 @@ public final class UrlChecker { } catch (UnsupportedEncodingException e) { return prepareUrl(query); } + } else if (lowerCaseUrl.contains("subscribeonandroid.com")) { + return prepareUrl(url.replaceFirst("((www.)?(subscribeonandroid.com/))", "")); } else if (!(lowerCaseUrl.startsWith("http://") || lowerCaseUrl.startsWith("https://"))) { Log.d(TAG, "Adding http:// at the beginning of the URL"); return "http://" + url; @@ -70,6 +72,11 @@ public final class UrlChecker { } } + public static boolean isDeeplinkWithoutUrl(String url) { + return url.toLowerCase(Locale.ROOT).contains(AP_SUBSCRIBE_DEEPLINK) + && Uri.parse(url).getQueryParameter("url") == null; + } + /** * Checks if URL is valid and modifies it if necessary. * This method also handles protocol relative URLs. diff --git a/ui/i18n/src/main/res/values/strings.xml b/ui/i18n/src/main/res/values/strings.xml index 924421df8..bfdd5ae99 100644 --- a/ui/i18n/src/main/res/values/strings.xml +++ b/ui/i18n/src/main/res/values/strings.xml @@ -317,7 +317,7 @@ Unknown title Feed Media file - No podcast was provided that could be shown. + The link you tapped does not contain a valid podcast URL. Please verify the link and try again, or search for the podcast manually. The suggested podcast did not have an RSS link, AntennaPod found a podcast that could match Authentication required Confirm mobile download