Merge pull request #2519 from k9mail/fix_linkifying_of_https_uris
Fix linkify issue with https: and rtsp: URIs
This commit is contained in:
commit
cc2c242c1f
2 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue