Browse Source

fix(presence): do not escape xml values (#768)

When receiving presence, the XML is converted to JSON. In
the process, Strophe.getText is used, which calls its
xmlescape utility function. This is not desired as the
raw value is desired, especially for display name.

Note: this issue only affects presence as it is the only
place that call the helper packet2JSON, which is the only
place that calls Strophe.getText.
master
virtuacoplenny 6 years ago
parent
commit
7b39059fba
No account linked to committer's email address
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      modules/xmpp/ChatRoom.js

+ 4
- 1
modules/xmpp/ChatRoom.js View File

@@ -29,7 +29,10 @@ export const parser = {
29 29
             const text = Strophe.getText(child);
30 30
 
31 31
             if (text) {
32
-                node.value = text;
32
+                // Using Strophe.getText will do work for traversing all direct
33
+                // child text nodes but returns an escaped value, which is not
34
+                // desirable at this point.
35
+                node.value = Strophe.xmlunescape(text);
33 36
             }
34 37
             nodes.push(node);
35 38
             this.packet2JSON(child, node.children);

Loading…
Cancel
Save