Browse Source

URI encode query string values

JC Brand 6 years ago
parent
commit
34a404eecc
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/converse-rosterview.js

+ 2 - 2
src/converse-rosterview.js

@@ -126,7 +126,7 @@ converse.plugins.add('converse-rosterview', {
                 };
                 };
                 const input_el = this.el.querySelector('input[name="name"]');
                 const input_el = this.el.querySelector('input[name="name"]');
                 input_el.addEventListener('input', _.debounce(() => {
                 input_el.addEventListener('input', _.debounce(() => {
-                    xhr.open("GET", `${_converse.xhr_user_search_url}q=${input_el.value}`, true);
+                    xhr.open("GET", `${_converse.xhr_user_search_url}q=${encodeURIComponent(input_el.value)}`, true);
                     xhr.send()
                     xhr.send()
                 } , 300));
                 } , 300));
                 this.name_auto_complete.on('suggestion-box-selectcomplete', ev => {
                 this.name_auto_complete.on('suggestion-box-selectcomplete', ev => {
@@ -185,7 +185,7 @@ converse.plugins.add('converse-rosterview', {
 
 
                 if (!jid && _converse.xhr_user_search_url && _.isString(_converse.xhr_user_search_url)) {
                 if (!jid && _converse.xhr_user_search_url && _.isString(_converse.xhr_user_search_url)) {
                     const input_el = this.el.querySelector('input[name="name"]');
                     const input_el = this.el.querySelector('input[name="name"]');
-                    this.xhr.open("GET", `${_converse.xhr_user_search_url}q=${input_el.value}`, true);
+                    this.xhr.open("GET", `${_converse.xhr_user_search_url}q=${encodeURIComponent(input_el.value)}`, true);
                     this.xhr.send()
                     this.xhr.send()
                     return;
                     return;
                 }
                 }