about summary refs log tree commit diff
path: root/scripts/main.js
diff options
context:
space:
mode:
authorGeorg Lukas <georg@op-co.de>2017-03-29 08:46:25 +0200
committerGeorg Lukas <georg@op-co.de>2017-03-29 08:52:32 +0200
commit518788dedf4f06dae6faaac29c17fac26ea24f79 (patch)
tree888cc4ffad101fcd5061c7c344c524747fc654ae /scripts/main.js
parentc48323994c33c4398b4ae92744bff1d9246a0344 (diff)
downloadphp-xmpp-invitation-518788dedf4f06dae6faaac29c17fac26ea24f79.tar.gz
URL-encoding: globals are evil, order matters
Diffstat (limited to 'scripts/main.js')
-rw-r--r--scripts/main.js9
1 files changed, 5 insertions, 4 deletions
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};
 	}