Revert "Patterns: attempt at fixing complex xmpp URIs (typically xmpp:#mychan%irc.server@xmpp.server.tld?join) (#3115)"

This reverts commit a4004904fe.
This commit is contained in:
Daniel Gultsch 2018-07-22 22:42:35 +02:00
parent fd28b32d56
commit f93cb8ede1
2 changed files with 5 additions and 9 deletions

View File

@ -28,11 +28,10 @@ import java.util.regex.Pattern;
public class Patterns { public class Patterns {
public static final Pattern XMPP_PATTERN = Pattern public static final Pattern XMPP_PATTERN = Pattern
.compile("xmpp:" .compile("xmpp\\:(?:(?:["
+ "(?:\\S+)" // any (one or more) non-whitespace prefix + Patterns.GOOD_IRI_CHAR
+ "@(?:[." + Patterns.GOOD_IRI_CHAR + "])+" // domain part, added the dot + "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])"
+ "(?:\\?[a-zA-Z]+)?" // optional action, can be any letter but no digit + "|(?:\\%[a-fA-F0-9]{2}))+");
);
/** /**
* Regular expression to match all IANA top-level domains. * Regular expression to match all IANA top-level domains.

View File

@ -91,10 +91,7 @@ public class XmppUri {
if (uri.getAuthority() != null) { if (uri.getAuthority() != null) {
jid = uri.getAuthority(); jid = uri.getAuthority();
} else { } else {
// At this point, it might be safe to assume that any instance of '%' or '#' in the String[] parts = uri.getSchemeSpecificPart().split("\\?");
// passed URI is the result of the user input and can safely be (should be?) encoded
Uri replaced = Uri.parse(lameUrlEncode(uri.toString()));
String[] parts = replaced.getSchemeSpecificPart().split("\\?");
if (parts.length > 0) { if (parts.length > 0) {
jid = parts[0]; jid = parts[0];
} else { } else {