summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2014-12-08 11:56:52 +0100
committerdaniel oeh <daniel.oeh@gmail.com>2014-12-08 11:56:52 +0100
commitbde86e018ade4a8d3977fa7198f5f19ee2a32ec9 (patch)
tree8ad6ce06b60954ae66bab9202053d8f67dc1878a /app/src
parent72d1bce2830126f465533a191eb15b853bf19aae (diff)
downloadAntennaPod-bde86e018ade4a8d3977fa7198f5f19ee2a32ec9.zip
Handle protocol relative URLs correctly when downloading episodes and images
fixes #568
Diffstat (limited to 'app/src')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java b/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java
index 47b58268b..aa197b6e1 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/URLCheckerTest.java
@@ -73,4 +73,32 @@ public class URLCheckerTest extends AndroidTestCase {
final String out = URLChecker.prepareURL(in);
assertEquals("https://example.com", out);
}
+
+ public void testProtocolRelativeUrlIsAbsolute() throws Exception {
+ final String in = "https://example.com";
+ final String inBase = "http://examplebase.com";
+ final String out = URLChecker.prepareURL(in, inBase);
+ assertEquals(in, out);
+ }
+
+ public void testProtocolRelativeUrlIsRelativeHttps() throws Exception {
+ final String in = "//example.com";
+ final String inBase = "https://examplebase.com";
+ final String out = URLChecker.prepareURL(in, inBase);
+ assertEquals("https://example.com", out);
+
+ }
+
+ public void testProtocolRelativeUrlIsHttpsWithAPSubscribeProtocol() throws Exception {
+ final String in = "//example.com";
+ final String inBase = "antennapod-subscribe://https://examplebase.com";
+ final String out = URLChecker.prepareURL(in, inBase);
+ assertEquals("https://example.com", out);
+ }
+
+ public void testProtocolRelativeUrlBaseUrlNull() throws Exception {
+ final String in = "example.com";
+ final String out = URLChecker.prepareURL(in, null);
+ assertEquals("http://example.com", out);
+ }
}