From f93cb8ede1af2c216b07fe2429e70945f739d347 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 22 Jul 2018 22:42:35 +0200 Subject: [PATCH] Revert "Patterns: attempt at fixing complex xmpp URIs (typically xmpp:#mychan%irc.server@xmpp.server.tld?join) (#3115)" This reverts commit a4004904fed081ac6f46c84178073900205bd325. --- src/main/java/eu/siacs/conversations/utils/Patterns.java | 9 ++++----- src/main/java/eu/siacs/conversations/utils/XmppUri.java | 5 +---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/utils/Patterns.java b/src/main/java/eu/siacs/conversations/utils/Patterns.java index dcbb24a0c..fae13aaea 100644 --- a/src/main/java/eu/siacs/conversations/utils/Patterns.java +++ b/src/main/java/eu/siacs/conversations/utils/Patterns.java @@ -28,11 +28,10 @@ import java.util.regex.Pattern; public class Patterns { public static final Pattern XMPP_PATTERN = Pattern - .compile("xmpp:" - + "(?:\\S+)" // any (one or more) non-whitespace prefix - + "@(?:[." + Patterns.GOOD_IRI_CHAR + "])+" // domain part, added the dot - + "(?:\\?[a-zA-Z]+)?" // optional action, can be any letter but no digit - ); + .compile("xmpp\\:(?:(?:[" + + Patterns.GOOD_IRI_CHAR + + "\\;\\/\\?\\@\\&\\=\\#\\~\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])" + + "|(?:\\%[a-fA-F0-9]{2}))+"); /** * Regular expression to match all IANA top-level domains. diff --git a/src/main/java/eu/siacs/conversations/utils/XmppUri.java b/src/main/java/eu/siacs/conversations/utils/XmppUri.java index e9ebb6534..0deb66a80 100644 --- a/src/main/java/eu/siacs/conversations/utils/XmppUri.java +++ b/src/main/java/eu/siacs/conversations/utils/XmppUri.java @@ -91,10 +91,7 @@ public class XmppUri { if (uri.getAuthority() != null) { jid = uri.getAuthority(); } else { - // At this point, it might be safe to assume that any instance of '%' or '#' in the - // 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("\\?"); + String[] parts = uri.getSchemeSpecificPart().split("\\?"); if (parts.length > 0) { jid = parts[0]; } else {