don’t escape jids when parsing from uri

This commit is contained in:
Daniel Gultsch 2020-05-17 08:53:44 +02:00
parent 351790b0c3
commit b347d57848
1 changed files with 5 additions and 5 deletions

View File

@ -34,7 +34,7 @@ public class XmppUri {
parse(Uri.parse(uri)); parse(Uri.parse(uri));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
try { try {
jid = Jid.of(uri).asBareJid().toString(); jid = Jid.ofEscaped(uri).asBareJid().toEscapedString();
} catch (IllegalArgumentException e2) { } catch (IllegalArgumentException e2) {
jid = null; jid = null;
} }
@ -137,7 +137,7 @@ public class XmppUri {
if (segments.size() >= 2 && segments.get(1).contains("@")) { if (segments.size() >= 2 && segments.get(1).contains("@")) {
// sample : https://conversations.im/i/foo@bar.com // sample : https://conversations.im/i/foo@bar.com
try { try {
jid = Jid.of(lameUrlDecode(segments.get(1))).toString(); jid = Jid.ofEscaped(lameUrlDecode(segments.get(1))).toEscapedString();
} catch (Exception e) { } catch (Exception e) {
jid = null; jid = null;
} }
@ -173,7 +173,7 @@ public class XmppUri {
} }
} else { } else {
try { try {
jid = Jid.of(uri.toString()).asBareJid().toString(); jid = Jid.ofEscaped(uri.toString()).asBareJid().toEscapedString();
} catch (final IllegalArgumentException ignored) { } catch (final IllegalArgumentException ignored) {
jid = null; jid = null;
} }
@ -195,7 +195,7 @@ public class XmppUri {
public Jid getJid() { public Jid getJid() {
try { try {
return this.jid == null ? null : Jid.of(this.jid); return this.jid == null ? null : Jid.ofEscaped(this.jid);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return null; return null;
} }
@ -206,7 +206,7 @@ public class XmppUri {
return false; return false;
} }
try { try {
Jid.of(jid); Jid.ofEscaped(jid);
return true; return true;
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return false; return false;