Fix linkify issue with https: and rtsp: URIs
This commit is contained in:
parent
0627ff5f87
commit
b52d7c7cd8
2 changed files with 12 additions and 2 deletions
|
@ -30,11 +30,11 @@ class HttpUriParser implements UriParser {
|
||||||
// Scheme
|
// Scheme
|
||||||
String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length()));
|
String shortScheme = text.substring(currentPos, Math.min(currentPos + 7, text.length()));
|
||||||
String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length()));
|
String longScheme = text.substring(currentPos, Math.min(currentPos + 8, text.length()));
|
||||||
if (shortScheme.equalsIgnoreCase("https://")) {
|
if (longScheme.equalsIgnoreCase("https://")) {
|
||||||
currentPos += "https://".length();
|
currentPos += "https://".length();
|
||||||
} else if (shortScheme.equalsIgnoreCase("http://")) {
|
} else if (shortScheme.equalsIgnoreCase("http://")) {
|
||||||
currentPos += "http://".length();
|
currentPos += "http://".length();
|
||||||
} else if (longScheme.equalsIgnoreCase("rtsp://")) {
|
} else if (shortScheme.equalsIgnoreCase("rtsp://")) {
|
||||||
currentPos += "rtsp://".length();
|
currentPos += "rtsp://".length();
|
||||||
} else {
|
} else {
|
||||||
return startPos;
|
return startPos;
|
||||||
|
|
|
@ -27,6 +27,16 @@ public class HttpUriParserTest {
|
||||||
assertLinkify("http://www.google.com");
|
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
|
@Test
|
||||||
public void invalidDomainIgnored() {
|
public void invalidDomainIgnored() {
|
||||||
assertLinkIgnored("http://-www.google.com");
|
assertLinkIgnored("http://-www.google.com");
|
||||||
|
|
Loading…
Reference in a new issue