Open trenki2 opened 8 years ago
Sorry I can't create a PR for this just yet, but we have a fix for this at https://github.com/REPLDigital/Sharp.Xmpp/commit/4159c0908e096e88132827a4a3394db2b587b7ab which should be quite painless to make
Yes, text has to escaped manually before using the library. However, @Cakez0r is elegant, thus with his permission I will include it in the library. Please note that this applies only for XMPP messages and not to any custom iq stanzas.
@pgstath Fine with me
Although I just noticed there should be null checks here too.
With that patch when I create a message with the body "body" and afterwards access the Body property I get returned the now modified body. This is unexpected, I think in that case I should get the body that I supplied. I would have to either unescape the body in the xmlelement or keep a separate variable with the original.
And when setting the Body property one would have to escape the text too. So i think the logic has to go into the property setter and getter.
When i try to send a message with the content <&> nothing is sent. Similarly when I try to send content that includes HTML tags bold the content is not sent verbatim.
When I manually escape the text before calling SendMessage() using HttpUtility.HtmlEncode(xml) it works as expected. I guess the message text would have to be escaped inside the library?