Browse Source

handle i2p domains without scheme (like main tlds)

master
R4SAS 6 years ago
parent
commit
6ae7bd9e48
  1. 5
      app/src/main/java/org/purplei2p/lightning/utils/UrlUtils.java

5
app/src/main/java/org/purplei2p/lightning/utils/UrlUtils.java

@ -38,6 +38,7 @@ public class UrlUtils {
'(' + // begin group for schema '(' + // begin group for schema
"(?:http|https|file)://" + "(?:http|https|file)://" +
"|(?:inline|data|about|javascript):" + "|(?:inline|data|about|javascript):" +
"|(?:.+\\.i2p)" +
"|(?:.*:.*@)" + "|(?:.*:.*@)" +
')' + ')' +
"(.*)"); "(.*)");
@ -66,7 +67,9 @@ public class UrlUtils {
// force scheme to lowercase // force scheme to lowercase
String scheme = matcher.group(1); String scheme = matcher.group(1);
String lcScheme = scheme.toLowerCase(); String lcScheme = scheme.toLowerCase();
if (!lcScheme.equals(scheme)) { if (lcScheme.contains(".i2p")) {
inUrl = "http://" + lcScheme + matcher.group(2);
} else if (!lcScheme.equals(scheme)) {
inUrl = lcScheme + matcher.group(2); inUrl = lcScheme + matcher.group(2);
} }
if (hasSpace && Patterns.WEB_URL.matcher(inUrl).matches()) { if (hasSpace && Patterns.WEB_URL.matcher(inUrl).matches()) {

Loading…
Cancel
Save