From 518788dedf4f06dae6faaac29c17fac26ea24f79 Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Wed, 29 Mar 2017 08:46:25 +0200 Subject: URL-encoding: globals are evil, order matters --- scripts/main.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/main.js b/scripts/main.js index 5c4e9c4..8a79b4f 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -48,15 +48,16 @@ key_prefix = "muc."; } - var jid_parts = display_data.jid.split("?"); - jid_parts[0] = encodeURIComponent(jid_parts[0]) // URL-encode the JID only - display_data.jid = jid_parts.join("?"); - // TODO: proper error checking / display / Creation of invitations if (jid.search("@") <= 0) return {jid:"", name: "Somebody"}; var name = jid.split("@")[0]; name = name.charAt(0).toUpperCase() + name.slice(1); + + var jid_parts = jid.split("?"); + jid_parts[0] = encodeURIComponent(jid_parts[0]) // URL-encode the JID only + jid = jid_parts.join("?"); + return {jid: jid, name: name}; } -- cgit 1.4.1