Fix linkify issue with https: and rtsp: URIs

This commit is contained in:
cketti 2017-04-30 02:42:07 +02:00
parent 0627ff5f87
commit b52d7c7cd8
2 changed files with 12 additions and 2 deletions

View file

@ -30,11 +30,11 @@ class HttpUriParser implements UriParser {
// Scheme
String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length()));
String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length()));
if (shortScheme.equalsIgnoreCase("https://")) {
if (longScheme.equalsIgnoreCase("https://")) {
currentPos += "https://".length();
} else if (shortScheme.equalsIgnoreCase("http://")) {
currentPos += "http://".length();
} else if (longScheme.equalsIgnoreCase("rtsp://")) {
} else if (shortScheme.equalsIgnoreCase("rtsp://")) {
currentPos += "rtsp://".length();
} else {
return startPos;

View file

@ -27,6 +27,16 @@ public class HttpUriParserTest {
assertLinkify("http://www.google.com");
}
@Test
public void simpleDomainWithHttps() {
assertLinkify("https://www.google.com");
}
@Test
public void simpleRtspUri() {
assertLinkify("rtsp://example.com/media.mp4");
}
@Test
public void invalidDomainIgnored() {
assertLinkIgnored("http://-www.google.com");